问题
i was facing some issues while struts migrating, i was using tiles in my application. below was the error
SEVERE: Error deploying web application archive
java.lang.UnsupportedClassVersionError: org/apache/struts2/tiles/StrutsTilesListener : Unsupported major.minor version 51.0 (unable to load class org.apache.struts2.tiles.StrutsTilesListener) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2822) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1148) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1643) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521) at org.apache.catalina.startup.WebAnnotationSet.loadClassAnnotation(WebAnnotationSet.java:144) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:73) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:56) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:353) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:885) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:317) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5081) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:932) at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:723) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1322) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89) at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:379) at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:324) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1041) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.startup.Catalina.start(Catalina.java:620) 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:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
This was the filter using in web.xml
struts2 org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
回答1:
The version of class org.apache.struts2.tiles.StrutsTilesListener
is 51.0 which corresponds to Java SE 7.
You can use Java : Unsupported major.minor version 51.0 solution to update your java installation.
来源:https://stackoverflow.com/questions/48981434/migrating-struts-2-3-to-2-5