1
votes

I need to have Tomcat with two grails applications installed.
Both applications should be using 8080 as follows:
localhost:8080/app1
localhost:8080/app2

I tried to put my two war files in webapps folder and then upload the server.
While server was uploading, I got this exception in my catalina.out log file:

Apr 23, 2014 1:27:27 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Apr 23, 2014 1:27:27 PM org.apache.coyote.AbstractProtocol init
SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"]
java.net.BindException: Address already in use :8080
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:410)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:640)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:434)
at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:978)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:813)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.startup.Catalina.load(Catalina.java:638)
at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
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:606)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:454)

Therefore, I need to know what is the best practice to upload tomcat with two grails apps.

Thanks for helping.

1
is there any other instance of tomcat running?jaipster
Strange, i am not sure but you try this netstat -tulpn | grep 8080. see if any process is running on this port. Try killing it and restart your tomcat.jaipster
It gave me this line: tcp 0 0 :::8080 :::* LISTEN 2743/javaroeygol
i suspect a tomcat running in the background. using ps -ef | grep tomcat will give you the process_id for process. use kill -9 <process_id> or killall java and then restart tomcat.jaipster
I tried to make it. By running this command I got only one process running and I killed it.roeygol

1 Answers

0
votes

How were these war files generated? With grails war?

I am a frequent deployer of Grails apps on Tomcat. Since there is no other service running on port 8080, it can be an issue caused by some trash in Tomcat. So, avoid to find yourself wasting time with the inner workings of Tomcat. If you can (your example is with localhost), a fast solution may be to try a fresh install of Tomcat. Otherwise, just try to clean the work and temp directories.

You also asked about the best practices... If you can stop Tomcat, do it, put the .war file in the webapps folder, and then, clean the work and temp directories before restarting it. Otherwise, just put the .war file in the webapps folder or send it through Tomcat Manager app (http://localhost:8080/manager). However, its common to get the PermGen space error after some redeploys. In this case, your only option will be to restart Tomcat.

As another tip, a better alternative to Tomcat Manager is PSI Probe (http://code.google.com/p/psi-probe/), that provides both more information and control on your applications and on Tomcat.