java.lang.UnsupportedClassVersionError:com / spinsci / empportal / ContextListener:不支持的major.minor版本52.0

时间:2016-04-21 13:08:15

标签: java unsupported-class-version

我试图通过Tomcat管理器webapp将war文件部署到我的本地服务器。当我试图开始部署后。我因为上下文路径中的应用程序无法获取错误开始。 这是web.xml和context.xml。

context.xml中

<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/EmpPortal1"></Context>

WEB.XML

<?xml version="1.0" encoding="UTF-8"?>  <web-app>

<context-param>
    <param-name>log4j-config-location</param-name>
    <param-value>WEB-INF/log4j.properties</param-value>
</context-param>

<listener>
    <listener-class>com.spinsci.empportal.ContextListener</listener-class>
</listener>
<servlet>
    <servlet-name>OnAppLoad</servlet-name>
    <servlet-class>com.emp.servlets.OnAppLoad</servlet-class>
</servlet>
<servlet>
    <servlet-name>Authentication</servlet-name>
    <servlet-class>com.emp.servlets.Authentication</servlet-class>
</servlet>
<servlet>
    <servlet-name>OnLeave</servlet-name>
    <servlet-class>com.emp.servlets.LeaveInformationServlet
    </servlet-class>
</servlet>
<servlet>
    <servlet-name>Empdir</servlet-name>
    <servlet-class>com.emp.servlets.Empdir</servlet-class>
</servlet>
<servlet>
    <servlet-name>ApproveRejectServlet</servlet-name>
    <servlet-class>com.emp.servlets.ApproveRejectServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>OnAppLoad</servlet-name>
    <url-pattern>/OnAppLoad</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Empdir</servlet-name>
    <url-pattern>/empdir</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Authentication</servlet-name>
    <url-pattern>/auth</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>OnLeave</servlet-name>
    <url-pattern>/OnLeave</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>ApproveRejectServlet</servlet-name>
    <url-pattern>/ApproveRejectServlet</url-pattern>
</servlet-mapping>
<session-config>
    <session-timeout>
        30
    </session-timeout>
</session-config>
<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

失败对话背后可能是什么原因。请让我知道。

添加了服务器日志

Apr 22, 2016 1:09:23 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'
Apr 22, 2016 1:09:37 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class com.spinsci.empportal.ContextListener
java.lang.UnsupportedClassVersionError: com/spinsci/empportal/ContextListener : Unsupported major.minor version 52.0 (unable to load class com.spinsci.empportal.Contex$
        at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:3111)
        at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1348)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1828)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)
        at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:506)
        at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:488)
        at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:115)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4919)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5517)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1095)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:558)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1717)
        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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1516)
        at org.apache.catalina.manager.HTMLManagerServlet.upload(HTMLManagerServlet.java:286)
        at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:206)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:213)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:614)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)

1 个答案:

答案 0 :(得分:-1)

上下文路径(或)上下文根对于服务器上部署的每个应用程序必须是唯一的。

因此,您无法将具有相同上下文根的两个应用程序部署到同一服务器。对于两个应用程序而言,上下文路径似乎是/.

检查server.xml以查看它们具有的上下文路径。如果它们不是唯一的,那么更改它们以解决问题。

但是如果你想为两个应用程序提供相同的上下文根,那么你需要将它们部署在两个不同的服务器上。