16

I have installed apache tomcat7 using the command apt-get. Now whenever I start my system, tomcat is running. I want to stop the tomcat so that I can start it within eclipse.

I tried stoping it with shutdown.sh command and I am getting the below error :

admin@admin-eMachines-E727:/usr/share/tomcat7/bin$ sudo /usr/share/tomcat7/bin/shutdown.sh
Using CATALINA_BASE:   /usr/share/tomcat7

Using CATALINA_HOME:   /usr/share/tomcat7

Using CATALINA_TMPDIR: /usr/share/tomcat7/temp

Using JRE_HOME:        /usr

Using CLASSPATH:       /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar

Jun 02, 2014 9:37:59 AM org.apache.catalina.startup.ClassLoaderFactory validateFile

WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]

Jun 02, 2014 9:37:59 AM org.apache.catalina.startup.ClassLoaderFactory validateFile

WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]

Jun 02, 2014 9:38:00 AM org.apache.catalina.startup.ClassLoaderFactory validateFile

WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]

Jun 02, 2014 9:38:00 AM org.apache.catalina.startup.ClassLoaderFactory validateFile

WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]

Jun 02, 2014 9:38:00 AM org.apache.catalina.startup.ClassLoaderFactory validateFile

WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]

Jun 02, 2014 9:38:00 AM org.apache.catalina.startup.ClassLoaderFactory validateFile

WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]

Jun 02, 2014 9:38:00 AM org.apache.catalina.startup.Catalina stopServer

SEVERE: Catalina.stop: 

java.io.FileNotFoundException: /usr/share/tomcat7/conf/server.xml (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:468)
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.stopServer(Bootstrap.java:371)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:458)

Please suggest me a solution for this issue. Thanks in advance.

21

Generally any service in Ubuntu can be managed by

sudo service <service_name> <argument>

Here service_name stands for name of the service, in your case it is tomcat7.

Argument stands for type of the action like start,stop,restart,status, in your case it is stop.

so finally you can stop tomcat7 with this below command.

sudo service tomcat7 stop
1
  • 3
    Stop is a one time deal. He would need to use sudo update-rc.d tomcat7 disable to stop it from restarting with pc when it boots
    – Virusboy
    Jun 2 '14 at 4:48
1

I've tried almost everything I found for this but I finally concluded this to be the best, simple and precise solution:

sudo systemctl start tomcat

This one is for starting the service

If you want to check the status then

sudo systemctl status tomcat

And for stopping:

sudo systemctl stop tomcat
2
  • How does this improve upon the accepted answer? Jul 8 '17 at 13:19
  • Just another direct terminal commands, and it also prevents Tomcat from restarting after reboot.
    – INagwani
    Jul 16 '17 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.