Stop tomcat on linux

how to stop tomcat7 in ubuntu?

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.(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) 

Источник

Читайте также:  Media converter in linux

‘How to SHUTDOWN Tomcat in Ubuntu?

1597 ? Ss 0:00 /usr/bin/jsvc -user tomcat6 -cp /usr/share/java/commons-daemon.jar:/usr/share/tomcat6/bin/bootstrap.jar -outfile SYSLOG -errfile SYSLOG -pidfile /var/run/tomcat6.pid -Djava.awt.headless=true -Xmx128M -Djava.endorsed.dirs=/usr/share/tomcat6/endorsed -Dcatalina.base=/var/lib/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.io.tmpdir=/tmp/tomcat6-temp -Djava.security.manager -Djava.security.policy=/var/lib/tomcat6/work/catalina.policy -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties org.apache.catalina.startup.Bootstrap

1598 ? S 0:00 /usr/bin/jsvc -user tomcat6 -cp /usr/share/java/commons-daemon.jar:/usr/share/tomcat6/bin/bootstrap.jar -outfile SYSLOG -errfile SYSLOG -pidfile /var/run/tomcat6.pid -Djava.awt.headless=true -Xmx128M -Djava.endorsed.dirs=/usr/share/tomcat6/endorsed -Dcatalina.base=/var/lib/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.io.tmpdir=/tmp/tomcat6-temp -Djava.security.manager -Djava.security.policy=/var/lib/tomcat6/work/catalina.policy -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties org.apache.catalina.startup.Bootstrap

1599 ? Sl 0:20 /usr/bin/jsvc -user tomcat6 -cp /usr/share/java/commons-daemon.jar:/usr/share/tomcat6/bin/bootstrap.jar -outfile SYSLOG -errfile SYSLOG -pidfile /var/run/tomcat6.pid -Djava.awt.headless=true -Xmx128M -Djava.endorsed.dirs=/usr/share/tomcat6/endorsed -Dcatalina.base=/var/lib/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.io.tmpdir=/tmp/tomcat6-temp -Djava.security.manager -Djava.security.policy=/var/lib/tomcat6/work/catalina.policy -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties org.apache.catalina.startup.Bootstrap

Should all these 3 processes — 1597, 1598, 1599 — be killed?

Источник

How Do I Start and Stop Apache Tomcat on Linux?

Apache Tomcat is a free, open-source web server and servlet container to implement the Java Servlet and the JavaServer Page specifications developed by the Apache Software Foundation to provide an HTTP server for Java Applications.

This tutorial will discuss two ways to start or stop the Apache Tomcat service on your Linux machine.

Method 1 – Startup Scripts

Apache Tomcat comes with startup scripts that you can use to start or stop the service. This method applies when you have an Apache Tomcat server installed as a binary release using a .zip or .tar archive.

If so, start by navigating to the bin directory of the Apache Tomcat as:

Inside the bin directory, you can view all the scripts to manage the service using the ls command:

To start the Apache Tomcat service using its startup script, run the script as:

NOTE: Ensure you have executed permissions for the scripts in this directory.

Читайте также:  Kali linux and mac

Once you execute the startup script, you should see an output indicating whether the Tomcat service is up.

Using CATALINA_BASE: / home / debian / apache-tomcat-10.0.10

Using CATALINA_HOME: / home / debian / apache-tomcat-10.0.10

Using CATALINA_TMPDIR: / home / debian / apache-tomcat-10.0.10 / temp

Using CLASSPATH: / home / debian / apache-tomcat-

10.0.10 / bin / bootstrap.jar: / home / debian / apache-tomcat-10.0.10 / bin / tomcat-juli.jar

By default, the Apache Tomcat service runs on port 8080; you can verify if it’s running using the lsof utility as:

The above command should show port 8080 as LISTEN:

COMMAND PID USER FD TYPE DEVICE SIZE / OFF NODE NAME

java 1562 debian 41u IPv6 1598 0t0 TCP * : 8080 ( LISTEN )

java 1562 debian 52u IPv6 19670 0t0 TCP 127.0.0.1: 8005 ( LISTEN )

To stop the Apache Tomcat service, run the shutdown script as:

You should get an example output as shown below:

Using CATALINA_BASE: / home / debian / apache-tomcat-10.0.10

Using CATALINA_HOME: / home / debian / apache-tomcat-10.0.10

Using CATALINA_TMPDIR: / home / debian / apache-tomcat-10.0.10 / temp

Using CLASSPATH: / home / debian / apache-tomcat-

10.0.10 / bin / bootstrap.jar: / home / debian / apache-tomcat-10.0.10 / bin / tomcat-juli.jar

Adding to PATH

Although starting up Apache Tomcat using its startup scripts is easy, you must specify the full path or be in the bin directory.

To resolve this, you can add the directory to the $PATH variable using the command:

Once you have the apache tomcat directory in your path, you can run the scripts from any location without specifying the full path.

You can also use the catalina.sh script to start and stop the apache service.

To start and stop the apache service respectively.

Method 2 – Using Systemctl

Another way to manage the Apache Tomcat service is to use systemctl. This method will work if Apache Tomcat is installed from the system repositories such as APT and RPM.

Читайте также:  Astra linux скопировать файл

To start the tomcat service, use the command:

To stop the service, enter the command:

Using Custom Unit File

You will notice that the above commands only work if you have the Apache Tomcat server installed from the system packages.

If you have Tomcat installed manually from a zip or tar package, you can create a custom unit file to manage the service using the systemd.

The following is an example tomcat.service file.

sudo touch / etc / systemd / system / tomcat.service

sudo vim / etc / systemd / system / tomcat.service

Enter the unit file contents as:

Description = «Apache Tomcat»

ExecStart = / home / debian / apache-tomcat-10.0.10 / bin / startup.sh

ExecStop = / home / debian / apache-tomcat-10.0.10 / bin / shutdown.sh

Next, reload the system daemon to load the new unit file as:

Finally, manage the tomcat service using the system as:

sudo systemctl start tomcat.service

sudo systemctl stop tomcat.service

Using the methods discussed above, you can now manage the Apache Tomcat service easily.

Conclusion

This article has covered two ways to start and stop the Apache Tomcat service depending on various installation methods.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list

Источник

Оцените статью
Adblock
detector