无法在linux服务器上的tomcat 6.0.24中部署war

时间:2014-07-26 06:38:45

标签: java apache tomcat servlets

我们正在上传名为demo_nfc.war的jsp servlet项目的战争,但我们在部署war文件时遇到以下错误。

==========================
Jul 25, 2014 3:07:53 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive demo_nfc.war
Jul 25, 2014 3:07:53 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat6/webapps/demo_nfc/WEB-INF/lib/servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jul 25, 2014 3:07:53 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat6/webapps/demo_nfc/WEB-INF/lib/servlet-api-3.0.20090124.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jul 25, 2014 3:07:53 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat6/webapps/demo_nfc/WEB-INF/lib/servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jul 25, 2014 3:07:53 PM org.apache.tomcat.util.modeler.Registry registerComponent
SEVERE: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/demo_nfc,J2EEApplication=none,J2EEServer=none
Jul 25, 2014 3:07:53 PM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying web application archive demo_nfc.war
java.lang.UnsupportedClassVersionError: com/servlet/AdminController : Unsupported major.minor version 51.0 (unable to load class com.servlet.AdminController)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2335)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:976)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1451)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329)
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:1074)
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:4377)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
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:593)
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:616)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
==========================

但是当我们使用单个jsp文件部署war时,它已成功部署。

1 个答案:

答案 0 :(得分:2)

那是因为你有编译器,你的项目是java 7,导出WAR,现在尝试部署它是使用Java 6运行时的tomcat容器。

因此,要么将tomcat配置为使用Java 6运行时,要么使用Java 7再次构建战争。