LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 01-31-2013, 05:35 AM   #1
vignesh4sh
Member
 
Registered: Oct 2012
Posts: 69

Rep: Reputation: Disabled
Tomcat Issue (multiple tomcat is running)


Hi,
when i stop the tomcat service
Quote:
sudo service tomcat1 stop
according to tomcat log server instance stopped, but in
"ps -auxww | grep tomcat" command tomcat running.

Quote:
tomcat1 9544 0.2 28.6 2534632 1100744 ? Sl Jan25 17:01 /usr/bin/java -Djava.util.logging.config.file=/data/tomcat1/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/data/tomcat1/endorsed -classpath /data/tomcat1/bin/bootstrap.jar:/data/tomcat1/bin/tomcat-juli.jar -Dcatalina.base=/data/tomcat1 -Dcatalina.home=/data/tomcat1 -Djava.io.tmpdir=/data/tomcat1/temp org.apache.catalina.startup.Bootstrap start
Quote:
sudo service tomcat1 stop
i get the following exception

i tried to stop again using the same command
Quote:

Jan 31, 2013 3:51:31 PM 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:327)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
at java.net.Socket.connect(Socket.java:546)
at java.net.Socket.connect(Socket.java:495)
at java.net.Socket.<init>(Socket.java:392)
at java.net.Socket.<init>(Socket.java:206)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:499)
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.stopServer(Bootstrap.java:371)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:453)
I need to kill the process everytime. I cant able to stop the service by
Quote:
sudo service tomcat1 stop
But if i start the service
Quote:
sudo service tomcat start
One more tomcat is running with different process.

Quote:
tomcat1 23333 0.5 24.9 3497560 959456 ? Sl 05:19 1:46 /usr/bin/java -Djava.util.logging.config.file=/data/tomcat1/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms2048m -Xmx2048m -XX:PermSize=512m -XX:MaxPermSize=512m -Djava.endorsed.dirs=/data/tomcat1/endorsed -classpath /data/tomcat1/bin/bootstrap.jar:/data/tomcat1/bin/tomcat-juli.jar -Dcatalina.base=/data/tomcat1 -Dcatalina.home=/data/tomcat1 -Djava.io.tmpdir=/data/tomcat1/temp org.apache.catalina.startup.Bootstrap start
tomcat1 25893 65.8 2.4 3317508 95580 pts/1 Sl 10:30 0:03 /usr/bin/java -Djava.util.logging.config.file=/data/tomcat1/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms2048m -Xmx2048m -XX:PermSize=512m -XX:MaxPermSize=512m -Djava.endorsed.dirs=/data/tomcat1/endorsed -classpath /data/tomcat1/bin/bootstrap.jar:/data/tomcat1/bin/tomcat-juli.jar -Dcatalina.base=/data/tomcat1 -Dcatalina.home=/data/tomcat1 -Djava.io.tmpdir=/data/tomcat1/temp org.apache.catalina.startup.Bootstrap start
ubuntu 25912 0.0 0.0 8104 924 pts/1 S+ 10:31 0:00 grep --color=auto tomcat
This is my startup script.

Quote:
#!/bin/sh
export CATALINA_HOME1=/data/tomcat1

# See how we were called.
case "$1" in
start)
# Start daemon.
echo -n "Starting Tomcat: "
su - tomcat1 -c $CATALINA_HOME1/bin/startup.sh
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/tomcat1
;;
stop)
# Stop daemons.
echo -n "Shutting down Tomcat: "
su - tomcat1 -c $CATALINA_HOME1/bin/shutdown.sh
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/tomcat1
echo
[ $RETVAL = 0 ] && rm -f /var/lock/tomcat1
;;
restart)
$0 stop
$0 start
;;
condrestart)
[ -e /var/lock/tomcat1 ] && $0 restart
;;
status)
status tomcat1
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0

Please suggest me an idea.

Thanks
 
Old 02-01-2013, 03:32 PM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Philly, PA
Distribution: Kubuntu x64, RHEL, Fedora Core, FreeBSD, Windows x64
Posts: 1,503
Blog Entries: 35

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
I've always had trouble with the shutdown.sh/startup.sh scripts provided with tomcat. For me, the most reliable way of handling the shutdown of tomcat was to use kill -s 15 command. Here's an example of a startup script I wrote for RedHat systems.

https://github.com/sag47/drexel-univ.../init.d/tomcat
 
Old 02-01-2013, 04:30 PM   #3
fl0
Member
 
Registered: May 2010
Location: Germany
Distribution: Slackware
Posts: 105

Rep: Reputation: 34
hi,

if you use rhel6 (or clones) take a look at /etc/sysconfig/tomcat6 , there is described how you can run multiple tomcat instances at one server.

regards fl0
 
Old 02-03-2013, 11:57 PM   #4
vignesh4sh
Member
 
Registered: Oct 2012
Posts: 69

Original Poster
Rep: Reputation: Disabled
Thanks for reply.
can this script run in ubuntu?
I using ubuntu 12.04


Thanks
 
Old 02-04-2013, 02:16 AM   #5
sag47
Senior Member
 
Registered: Sep 2009
Location: Philly, PA
Distribution: Kubuntu x64, RHEL, Fedora Core, FreeBSD, Windows x64
Posts: 1,503
Blog Entries: 35

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
It should with minor modifications. On Ubuntu, you'll likely have trouble with "success" and "failure" commands within the stop() function. I make no guarantees so use at your own risk. It falls under MIT license.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
servlet permission issue on SB computer running tomcat container bard Linux - Embedded & Single-board computer 2 11-04-2012 02:40 PM
Session replication using apache+mod_jk+tomcat(5.5.28-veriosn of tomcat) sreejithp Linux - Server 1 12-24-2010 07:46 AM
Tomcat 6.0 on Linux, after modifying tomcat-users.xml still cannot login. cuian01 Linux - Newbie 1 01-28-2010 04:45 AM
TOMCAT init script not working on startup -- tomcat 4.x / Mandrake Linux 8.0 jmartinph Mandriva 0 03-08-2004 02:31 AM


All times are GMT -5. The time now is 02:58 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration