This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Multiple webapps deployment on tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Multiple webapps deployment on tomcat" Watch "Multiple webapps deployment on tomcat" New topic
Author

Multiple webapps deployment on tomcat

Rafael Nathan
Greenhorn

Joined: Oct 09, 2012
Posts: 3
Hi,

I have setup Apache Tomcat on my CentOS machine and it seems to work as a charm initially and a service tomcat start leaves me with output as such
Using CATALINA_BASE: /usr/share/apache-tomcat
Using CATALINA_HOME: /usr/share/apache-tomcat
Using CATALINA_TMPDIR: /usr/share/apache-tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/share/apache-tomcat/bin/bootstrap.jar:/usr/share/apache-tomcat/bin/tomcat-juli.jar

Further, I deployed the apache roller webapp and it works well and as soon as I deploy another instance of Apache roller the container crashes I wonder why ?
A restart now leaves me with this :
Using CATALINA_BASE: /usr/share/apache-tomcat
Using CATALINA_HOME: /usr/share/apache-tomcat
Using CATALINA_TMPDIR: /usr/share/apache-tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/share/apache-tomcat/bin/bootstrap.jar:/usr/share/apache-tomcat/bin/tomcat-juli.jar
Oct 09, 2012 6:40:05 AM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:337)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:198)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.<init>(Socket.java:425)
at java.net.Socket.<init>(Socket.java:208)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:490)
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:601)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:371)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:453)

Using CATALINA_BASE: /usr/share/apache-tomcat
Using CATALINA_HOME: /usr/share/apache-tomcat
Using CATALINA_TMPDIR: /usr/share/apache-tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/share/apache-tomcat/bin/bootstrap.jar:/usr/share/apache-tomcat/bin/tomcat-juli.jar

I am unable to deploy more than one webapp

Here is my /etc/init.d/tomcat script
#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/usr/java/jdk1.7.0_01
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/share/apache-tomcat
RETVAL=0

status() {
SHUTDOWN_PORT=$(netstat -vtnl|grep 8005|wc -l)
if [ $SHUTDOWN_PORT -eq 0 ]; then
echo "tomcat is not running..."
RETVAL=1
exit $RETVAL
else
echo "tomcat is running..."
RETVAL=0
exit $RETVAL
fi
}

case $1 in
start)
su - admin -c $CATALINA_HOME/bin/startup.sh
;;
stop)
su - admin -c $CATALINA_HOME/bin/shutdown.sh
;;
restart)
su - admin -c $CATALINA_HOME/bin/shutdown.sh
su - admin -c $CATALINA_HOME/bin/startup.sh
;;
status)
status
;;
*)
echo $"Usage: tomcat {start|stop|restart|status}"
exit 1
esac

exit $RETVAL


Please help. Need to get it working badly

Thanks in advance.

Best Regards,
Rafael Nathan

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

Welcome to the JavaRanch, Rafael!

You cannot have 2 identical instances of the Tomcat server running at the same time on the same machine. The TCP/IP architecture only allows one program to listen on any one port.

There is some confusion as to what you mean when you say "multiple webapps". A single copy of Tomcat can hold more than one webapp - there's no need to start a second Tomcat, if that's what you are doing.

Customer surveys are for companies who didn't pay proper attention to begin with.
Rafael Nathan
Greenhorn

Joined: Oct 09, 2012
Posts: 3
Hi Tim,

Thanks for the quick reply.

I unpacked the webapp Apache roller in the webapps directory with the name roller1 and restarted tomcat. Yet again, I unpacked another copy of Apache roller in the webapps directory with the name roller2 and restarted tomcat.

However, tomcat crashes and I am left with nothing

Please help
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

Rafael Nathan wrote:
However, tomcat crashes and I am left with nothing


No even a stack trace?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Multiple webapps deployment on tomcat
 
Similar Threads
Eclipse Indigo and Tomcat7 integration on ubuntu 11.10
Tomcat7 on Eclipse indigo not working
Tomcat startup problems
Tomcat6 on Ubuntu
Setting Tomcat in Ubuntu 11.10