vision2
vision2

Reputation: 33

Starting Tomcat with local user causes JVM_Bind exception

I have a tomcat service that starts fine with the local system account but when I switch it over to log on as a local user I am getting a JVM_Bind exception. The service starts and then shuts down.

It looks like the shutdown port is already being used by another service. I can change the tomcat service to use a different shutdown port, but I want to understand why it starts fine with the system account and complains about the shutdown port with the user account.

06-Jun-2017 15:46:13.801 SEVERE [main] org.apache.catalina.core.StandardServer.await StandardServer.await: create[localhost:10006]: 
 java.net.BindException: Address already in use: JVM_Bind
    at java.net.DualStackPlainSocketImpl.bind0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106)
    at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190)
    at java.net.ServerSocket.bind(ServerSocket.java:375)
    at java.net.ServerSocket.<init>(ServerSocket.java:237)
    at org.apache.catalina.core.StandardServer.await(StandardServer.java:420)
    at org.apache.catalina.startup.Catalina.await(Catalina.java:713)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:659)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)

Upvotes: 0

Views: 1270

Answers (2)

Praveen Kumar K S
Praveen Kumar K S

Reputation: 3074

Generic Solution for Tomcat JVM_BIND exceptions
Windows
1) Might be some other services listening to the same port 8080, In such cases go to %TOMCAT_HOME%/conf/server.xml and change the port to your desired integer like 8081,9080 etc.
2) Go to Windows task manager and check for some other java process running behind, if running end the process.
3) You can do netstat command on Windows to check for active connections and check for 8080 or (whatever your configured) ports which is listening and kill those services.

Netstat

Linux
1) ps - ef ¦ grep java use this command to identify the process running behind, if many processes running which is not relevant. You can kill the process by kill - 9 processid
2) You can do the netstat command on linux and check for the 8080 or (whatever your configured) ports which is listening and kill those services.
3) Also you can change your $TOMCAT_HOME/conf/server.xml port number to your desired integers.

Mac

  1. Kill processId terminal kill <pid>

    To find ProcessId use this below command.
    lsof -i:

  2. Also you can change your $TOMCAT_HOME/conf/server.xml port number to your desired integers.

Upvotes: 0

vision2
vision2

Reputation: 33

Found that one service was listening to the invalid address and the Tomcat Service was listening on the loopback address.

According to https://msdn.microsoft.com/en-us/library/windows/desktop/ms740621(v=vs.85).aspx

If both application are in the same user context then both can bind to the same port if one of the application is using the invalid address. (0.0.0.0)

If both application are in different user context then we get the exception.

Upvotes: 1

Related Questions