Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat startup, 8080 address already in use

The setup is:

  • Amazon EC2
  • Tomcat (with secure forwarding to 8443)
  • Apache 2.2

I run the shutdown.sh, and I get no errors.

BUT when I try to runt the startup.sh I get this error:

07-Nov-2011 17:40:40 org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386/client:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib 07-Nov-2011 17:40:41 org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 07-Nov-2011 17:40:41 org.apache.coyote.http11.Http11Protocol init SEVERE: Error initializing endpoint java.net.BindException: Address already in use <null>:8080         at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:549)         at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:176)         at org.apache.catalina.connector.Connector.initialize(Connector.java:1022)         at org.apache.catalina.core.StandardService.initialize(StandardService.java:703)         at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:838)         at org.apache.catalina.startup.Catalina.load(Catalina.java:538)         at org.apache.catalina.startup.Catalina.load(Catalina.java:562)         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         at java.lang.reflect.Method.invoke(Method.java:616)         at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: java.net.BindException: Address already in use         at java.net.PlainSocketImpl.socketBind(Native Method)         at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:336)         at java.net.ServerSocket.bind(ServerSocket.java:336)         at java.net.ServerSocket.<init>(ServerSocket.java:202)         at java.net.ServerSocket.<init>(ServerSocket.java:158)         at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:50)         at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:538)         ... 12 more 07-Nov-2011 17:40:41 org.apache.catalina.core.StandardService initialize SEVERE: Failed to initialize connector [Connector[HTTP/1.1-8080]] LifecycleException:  Protocol handler initialization failed: java.net.BindException: Address already in use <null>:8080         at org.apache.catalina.connector.Connector.initialize(Connector.java:1024)         at org.apache.catalina.core.StandardService.initialize(StandardService.java:703)         at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:838)         at org.apache.catalina.startup.Catalina.load(Catalina.java:538)         at org.apache.catalina.startup.Catalina.load(Catalina.java:562)         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         at java.lang.reflect.Method.invoke(Method.java:616)         at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) 07-Nov-2011 17:40:41 org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8443 07-Nov-2011 17:40:41 org.apache.catalina.startup.Catalina load INFO: Initialization processed in 615 ms 07-Nov-2011 17:40:41 org.apache.catalina.core.StandardService start INFO: Starting service Catalina 07-Nov-2011 17:40:41 org.apache.catalina.core.StandardEngine start  INFO: Starting service Catalina 07-Nov-2011 17:40:41 org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/6.0.33 07-Nov-2011 17:40:41 org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor host-manager.xml 07-Nov-2011 17:40:41 org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor manager.xml 07-Nov-2011 17:40:41 org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive test.war log4j:WARN No appenders could be found for logger (StackTrace). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. log4j:ERROR Error initializing log4j: grails/plugins/springsecurity/SecurityConfigType : Unsupported major.minor version 51.0 (unable to load class grails.plugins.springsecurity.SecurityConfigType) java.lang.UnsupportedClassVersionError: grails/plugins/springsecurity/SecurityConfigType : Unsupported major.minor version 51.0 (unable to load class grails.plugins.springsecurity.SecurityConfigType)         at java.lang.Class.forName0(Native Method)         at java.lang.Class.forName(Class.java:186)         at Config.class$(Config.groovy)         at Config.$get$$class$grails$plugins$springsecurity$SecurityConfigType(Config.groovy)         at Config.run(Config.groovy:116) 07-Nov-2011 17:40:43 org.apache.catalina.core.StandardContext start SEVERE: Error listenerStart 07-Nov-2011 17:40:43 org.apache.catalina.core.StandardContext start SEVERE: Context [/test] startup failed due to previous errors 07-Nov-2011 17:40:43 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc SEVERE: The web application [/test] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 07-Nov-2011 17:40:43 org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive browser.war 07-Nov-2011 17:40:43 org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory examples 07-Nov-2011 17:40:43 org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory ROOT 07-Nov-2011 17:40:43 org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory docs 07-Nov-2011 17:40:43 org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8080 07-Nov-2011 17:40:43 org.apache.coyote.http11.Http11Protocol start SEVERE: Error starting endpoint java.net.BindException: Address already in use <null>:8080         at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:549)         at org.apache.tomcat.util.net.JIoEndpoint.start(JIoEndpoint.java:565)         at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:203)         at org.apache.catalina.connector.Connector.start(Connector.java:1095)         at org.apache.catalina.core.StandardService.start(StandardService.java:540)         at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)         at org.apache.catalina.startup.Catalina.start(Catalina.java:595)         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         at java.lang.reflect.Method.invoke(Method.java:616)   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Caused by: java.net.BindException: Address already in use         at java.net.PlainSocketImpl.socketBind(Native Method)         at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:336)         at java.net.ServerSocket.bind(ServerSocket.java:336)         at java.net.ServerSocket.<init>(ServerSocket.java:202)         at java.net.ServerSocket.<init>(ServerSocket.java:158)         at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:50)         at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:538)         ... 12 more 07-Nov-2011 17:40:43 org.apache.catalina.core.StandardService start SEVERE: Failed to start connector [Connector[HTTP/1.1-8080]] LifecycleException:  service.getName(): "Catalina";  Protocol handler start failed: java.net.BindException: Address already in use <null>:8080         at org.apache.catalina.connector.Connector.start(Connector.java:1102)         at org.apache.catalina.core.StandardService.start(StandardService.java:540)         at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)         at org.apache.catalina.startup.Catalina.start(Catalina.java:595)         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         at java.lang.reflect.Method.invoke(Method.java:616)         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 07-Nov-2011 17:40:43 org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8443 07-Nov-2011 17:40:43 org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 07-Nov-2011 17:40:43 org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/120  config=null 07-Nov-2011 17:40:43 org.apache.catalina.startup.Catalina start INFO: Server startup in 2286 ms 07-Nov-2011 17:42:14 org.apache.coyote.http11.Http11Protocol pause INFO: Pausing Coyote HTTP/1.1 on http-8080 07-Nov-2011 17:42:14 org.apache.coyote.http11.Http11Protocol pause INFO: Pausing Coyote HTTP/1.1 on http-8080 07-Nov-2011 17:42:14 org.apache.coyote.http11.Http11Protocol pause INFO: Pausing Coyote HTTP/1.1 on http-8443 07-Nov-2011 17:42:15 org.apache.catalina.core.StandardService stop INFO: Stopping service Catalina 07-Nov-2011 17:42:15 org.apache.coyote.http11.Http11Protocol destroy INFO: Stopping Coyote HTTP/1.1 on http-8080 07-Nov-2011 17:42:15 org.apache.coyote.http11.Http11Protocol destroy INFO: Stopping Coyote HTTP/1.1 on http-8080 07-Nov-2011 17:42:15 org.apache.coyote.http11.Http11Protocol destroy INFO: Stopping Coyote HTTP/1.1 on http-8443 

I've tried commands such as netstat -aon | grep 8080 I've tried ps -efl | grep java and killing that process using kill <pid> 9 pkill java and so on...

This is what netstat -aon

Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address               Foreign Address             State       Timer tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      off (0.00/0/0) tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      off (0.00/0/0) tcp        0      0 10.226.122.156:22           109.58.56.15:49215          ESTABLISHED keepalive (5354.40/0/0) tcp        0      0 :::80                       :::*                        LISTEN      off (0.00/0/0) tcp        0      0 :::22                       :::*                        LISTEN      off (0.00/0/0) udp        0      0 0.0.0.0:68                  0.0.0.0:*                               off (0.00/0/0) udp        0      0 10.226.122.156:123          0.0.0.0:*                               off (0.00/0/0) udp        0      0 127.0.0.1:123               0.0.0.0:*                               off (0.00/0/0) udp        0      0 0.0.0.0:123                 0.0.0.0:*                               off (0.00/0/0) udp        0      0 ::1:123                     :::*                                    off (0.00/0/0) udp        0      0 fe80::1031:3cff:fe0:123     :::*                                    off (0.00/0/0) udp        0      0 :::123                      :::*                                    off (0.00/0/0) Active UNIX domain sockets (servers and established) Proto RefCnt Flags       Type       State         I-Node Path unix  2      [ ACC ]     STREAM     LISTENING     2337   @/tmp/fam-root- unix  2      [ ACC ]     STREAM     LISTENING     409    @/com/ubuntu/upstart unix  2      [ ]         DGRAM                    644    @/org/kernel/udev/udevd unix  8      [ ]         DGRAM                    1513   /dev/log unix  3      [ ]         STREAM     CONNECTED     38302 unix  3      [ ]         STREAM     CONNECTED     38301 unix  2      [ ]         DGRAM                    38297 unix  2      [ ]         DGRAM                    22149 unix  3      [ ]         STREAM     CONNECTED     2340   @/tmp/fam-root- unix  3      [ ]         STREAM     CONNECTED     2339 unix  2      [ ]         DGRAM                    1998 unix  2      [ ]         DGRAM                    1918 unix  2      [ ]         DGRAM                    1895 unix  2      [ ]         DGRAM                    1819 unix  3      [ ]         DGRAM                    648 unix  3      [ ]         DGRAM                    647 

Any thoughts or pointers?

like image 948
marko Avatar asked Nov 07 '11 18:11

marko


People also ask

How do I fix the start of Tomcat failed the server port 8080 is already in use?

Change your Tomcat port address to 8084 and Shut Down Port to 8025 . This will resolve your problem.


1 Answers

I also had the same issue. Tried all the options suggested in this thread. But didnt help. Then just did ran:

ps -awwef | grep tomcat 

and found some stale process running. I killed it using (-15 instead of -9)

sudo kill -15 <tomcat pid from previous command> 

And woot! it worked. Restarted tomcat without any issue.

like image 54
user1968048 Avatar answered Sep 30 '22 21:09

user1968048