Ubuntu: how to stop tomcat7 in ubuntu?



Question:

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.


Solution:1

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  


Solution:2

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  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »