Showing posts with label Exception. Show all posts
Showing posts with label Exception. Show all posts

Friday, April 27, 2018

Windows: java.net.BindException: Address already in use: bind

Issue Details:


Caused by: java.net.BindException: Address already in use: bind

        at sun.nio.ch.Net.bind0(Native Method)

        at sun.nio.ch.Net.bind(Net.java:433)

        at sun.nio.ch.Net.bind(Net.java:425)

        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)

        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)

        at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:210)

        at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:980)

        at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:573)

        at org.apache.catalina.connector.Connector.startInternal(Connector.java:993)

        ... 17 common frames omitted

27-04-2018 23:31:20 [o.a.c.h.Http11NioProtocol:179] log : Pausing ProtocolHandler ["http-nio-3000"]

27-04-2018 23:31:20 [o.a.c.c.StandardService:179] log : Stopping service Tomcat

27-04-2018 23:31:20 [o.a.c.u.LifecycleBase:179] log : The stop() method was called on component [StandardServer[-1]] after stop() had already been called. The second call will be ignored.

27-04-2018 23:31:20 [o.a.c.h.Http11NioProtocol:179] log : Stopping ProtocolHandler ["http-nio-3000"]

27-04-2018 23:31:20 [o.a.c.h.Http11NioProtocol:179] log : Destroying ProtocolHandler ["http-nio-3000"]

27-04-2018 23:31:20 [o.s.b.a.l.AutoConfigurationReportLoggingInitializer:101] logAutoConfigurationReport :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.

27-04-2018 23:31:20 [o.s.b.d.LoggingFailureAnalysisReporter:42] report :

***************************

APPLICATION FAILED TO START

***************************

Description:

The Tomcat connector configured to listen on port 3000 failed to start. The port may already be in use or the connector may be misconfigured.

Fixation: 

First, find out which PID is using the port 3000. Then kill the process id.

C:\Users\drakula>netstat -ano | find "3000"

  TCP    0.0.0.0:3000           0.0.0.0:0              LISTENING       8464

  TCP    [::]:3000              [::]:0                 LISTENING       8464

C:\Users\drakula>TASKKILL /PID 8464 /F

SUCCESS: The process with PID 8464 has been terminated.

C:\Users\drakula>

Saturday, December 2, 2017

android.security.KeyStoreException: Invalid key blob

This problem is occurred when user tries to UNLOCK from LOCK/UNINITIALIZED. It is by default defined as 30 secs for timing. This problem is it's API related implementation issue.
This error is generated from InvalidKeyException. By bypassing this exception and call the method again, you can get rid of this error.
You have to remove the InvalidKeyException class from the catch argument. This will still allow you to check for InvalidKeyException. After checking you have to try for second time with code so that the problem is not shown in eye but doing 2 times checking it may solve your issue. Code is given below.
try {
    KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) this.keyStore
            .getEntry("alias", null);

} catch (InvalidKeyException ex) {
    ex.printStackTrace();
    if (ex instanceof InvalidKeyException) { // bypass
                                                // InvalidKeyException
        // You can again call the method and make a counter for deadlock
        // situation or implement your own code according to your
        // situation
        if (retry) {
            keyStore.deleteEntry(keyName);
            return getCypher(keyName, false);
        } else {
            throw ex;
        }
    }
} catch (final Exception e) {
    e.printStackTrace();
    throw e;
}
You can see my another answer that describes one by one occurring issue and solution.

UPDATE from @Ankis:

As you solved the issue by changing InvalidKeyException to UnrecoverableKeyException. So I have updated as per your suggestion so that world can know the actual answer. Thanks for sharing :).
try {
    KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) this.keyStore
            .getEntry("alias", null);

} catch (UnrecoverableKeyException ex) {
    ex.printStackTrace();
        // You can again call the method and make a counter for deadlock
        // situation or implement your own code according to your
        // situation
        if (retry) {
            keyStore.deleteEntry(keyName);
            return getCypher(keyName, false);
        }
} catch (final Exception e) {
    e.printStackTrace();
    throw e;
}
Original Link: android.security.KeyStoreException: Invalid key blob