The problem of Tomcat not finding a Java virtual machine when Linux started

Source: Internet
Author: User
       recently studied Java under the Slackware. It's inconvenient to start the Tomcat manually every time. So suit wrote a script to run Tomcat automatically when it was powered on.        using JDK1.5.6, installed under the/app/jdk1.5.0_06 directory, Tomcat is a zip version of 5.5.
#!/bin/sh # #/etc/rc.d/rc.tomcat # # Start/stop/restart the tomcat server. # Tomcat_start () {if [-x/app/tomcat5.5/bin/startup.sh]; then echo starting Tomcat:/app/tomcat5.5/bin/startup. SH "/app/tomcat5.5/bin/startup.sh fi} tomcat_stop () {if [-x/app/tomcat5.5/bin/startup.sh]; then echo" Sto P Tomcat:/app/tomcat5.5/bin/shutdown.sh "/app/tomcat5.5/bin/shutdown.sh fi} tomcat_restart () {Tomcat_stop Slee P 2 Tomcat_start} case "$" in ' start ') tomcat_start;; ' Stop ') tomcat_stop;; ' Restart ') Tomcat_restart;; *) Tomcat_start Esac
The script holds the path/ETC/RC.D/RC.TOMCAT. Note that you want to give execution permissions.   Then add a sentence to the/etc/rc.d/rc.local file:/etc/rc.d/rc.tomcat executes the Rc.tomcat file every time the starter is started. The problem with starting up is that our Java path information was written in/etc/profile, such as:
Java_home=/app/jdk1.5.0_06 classpath=.: $JAVA _home/lib: $JAVA _home/jre/lib path=.: $JAVA _home/bin: $JAVA _home/jre/ Bin: $PATH export java_home CLASSPATH PATH
Users have to log in before the path information can take effect, so there is a manual can start Tomcat, but random start problems. Modify the Rc.tomcat's finger script and specify the JDK path for it.
#!/bin/sh # #/etc/rc.d/rc.tomcat # Start/stop/restart the tomcat server. #   JAV A_HOME=/APP/JDK1.5.0_06 Export java_home   Tomcat_start () { if [-x/app/tomcat5.5/bin/startup.sh]; then   ;   echo "Starting tomcat: /app/tomcat5.5/bin/startup.sh"    /app/tomcat5.5/bin/ startup.sh  fi}   Tomcat_stop () { if [-x/app/tomcat5.5/bin/startup.sh]; then     Echo Stop tomcat: /app/tomcat5.5/bin/shutdown.sh "   /app/tomcat5.5/bin/shutdown.sh  fi}   Tomcat_restart () { tomcat_stop  sleep 2  tomcat_start}   case "$" in ' start ')  tomcat_s Tart  ;; ' Stop ')  tomcat_stop  ;; ' Restart ')  tomcat_restart  ;; *)  tomcat_start Esac
  very simple, just before the beginning of the script to add two lines of JAVA path information: java_home=/app/jdk1.5.0_06 export java_home again after the boot information: If not believe, ssh in Nmap. Straight to why there is a 8000 Http-alt port, please refer to my another article under Tomcat5.5 to open the remote debugging port, this remote port is not open by default.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.