问题:
:/tomcat8/bin$ sudo ./configtest.sh
Using CATALINA_BASE: /home/yyb/android/tomcat8
Using CATALINA_HOME: /home/yyb/android/tomcat8
Using CATALINA_TMPDIR: /home/yyb/android/tomcat8/temp
Using JRE_HOME: /home/yyb/android/jdk1.6.0_45/jre
Using CLASSPATH: /home/yyb/android/tomcat8/bin/bootstrap.jar:/home/yyb/android/tomcat8/bin/tomcat-juli.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/catalina/startup/Bootstrap : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.apache.catalina.startup.Bootstrap. Program will exit.
Configuration error detected!
解决方法:
由于JRE的版本号不正确
# OS specific support. $var _must_ be set to either true or false.
在前面加上
CATALINA_HOME=/usr/local/tomcat8
JAVA_HOME=/home/yyb/android/jdk1.7.0_55
JRE_HOME=/home/yyb/android/jdk1.7.0_55/jre
測试是否成功:
[email protected]:/usr/local/tomcat8/bin$ sudo ./configtest.sh
Using CATALINA_BASE: /usr/local/tomcat8
Using CATALINA_HOME: /usr/local/tomcat8
Using CATALINA_TMPDIR: /usr/local/tomcat8/temp
Using JRE_HOME: /home/yyb/android/jdk1.7.0_55/jre
Using CLASSPATH: /usr/local/tomcat8/bin/bootstrap.jar:/usr/local/tomcat8/bin/tomcat-juli.jar
四月 27, 2014 11:48:05 上午 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
四月 27, 2014 11:48:05 上午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-nio-8080"]
四月 27, 2014 11:48:05 上午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
四月 27, 2014 11:48:05 上午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-nio-8009"]
四月 27, 2014 11:48:05 上午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
信息: Using a shared selector for servlet write/read
四月 27, 2014 11:48:05 上午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 939 ms
[email protected]:/usr/local/tomcat8/bin$
[email protected]:/usr/local/tomcat8/bin$ sudo ./startup.sh
Using CATALINA_BASE: /usr/local/tomcat8
Using CATALINA_HOME: /usr/local/tomcat8
Using CATALINA_TMPDIR: /usr/local/tomcat8/temp
Using JRE_HOME: /home/yyb/android/jdk1.7.0_55/jre
Using CLASSPATH: /usr/local/tomcat8/bin/bootstrap.jar:/usr/local/tomcat8/bin/tomcat-juli.jar
Tomcat started.
[email protected]:/usr/local/tomcat8/bin$ sudo ./shutdown.sh
Using CATALINA_BASE: /usr/local/tomcat8
Using CATALINA_HOME: /usr/local/tomcat8
Using CATALINA_TMPDIR: /usr/local/tomcat8/temp
Using JRE_HOME: /home/yyb/android/jdk1.7.0_55/jre
Using CLASSPATH: /usr/local/tomcat8/bin/bootstrap.jar:/usr/local/tomcat8/bin/tomcat-juli.jar
[email protected]:/usr/local/tomcat8/bin$
输入http://localhost:8080 看到以下则成功
tomcat的安装參考
http://www.cnlogs.com/rayz/archive/2013/05/20/3089302.html