Linux下Tomcat启动失败


Linux下重启Tomcat失败。

 

日志文件的内容如下:

2011-3-7 16:59:46 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/lib64/jvm/java-1.5.0-sun-1.5.0_update12/jre/lib/amd64/server:/usr/lib64/jvm/java-

1.5.0-sun-1.5.0_update12/jre/lib/amd64:/usr/lib64/jvm/java-1.5.0-sun-1.5.0_update12/jre/../lib/amd64
2011-3-7 16:59:46 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2011-3-7 16:59:46 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 515 ms
2011-3-7 16:59:46 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2011-3-7 16:59:46 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.20
2011-3-7 16:59:46 org.apache.tomcat.util.modeler.Registry registerComponent
严重: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/,J2EEApplication=none,J2EEServer=none
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class

com.cache.CacheTask)
        at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1854)
        at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:108)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:58)
        at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:297)
        at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1068)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4339)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
        ... 6 more


分析:
    项目开发的环境是 JRE1.6B版本,而Tomcat的环境是JRE1.5版本。
    这是由于tomcat下设置的JDK与项目使用的JDK版本不一致所导致的!!!

解决方案:
    更换JRE版本:从JRE1.5 升级到 JRE1.6,即可。


============================================================
备注:
    若在myeclipse中启动tomcat,还是提示如上错误,其原因是一样的。


解决办法:
1.打开MyEclipse
2.Window
3.Preferences
4.选择Java节点
5.Installed JREs
6.可以看到当前使用的JVM是什么版本,路径在哪里,现在我们要改正和Tomcat一样的虚拟机.
6.Edit
7.JRE home directory
8.Browse 找到:C:\Sun\SDK\jdk\jre(找到你的安装目录)
9.ok
搞定了.!

 

 

 

你可能感兴趣的:(java,apache,tomcat,linux,MyEclipse)