关于Unsupported major.minor version 52.0 错误的解决方案

最近几天做了一个基于Maven的ssm框架,在配置好Maven的jar包后,前端集成了bootstrap,在启动tomcat时报了个错误,tomcat没有启动成功:
严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ssm-crud]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ssm-crud]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
… 6 more
Caused by: java.lang.UnsupportedClassVersionError: org/springframework/web/SpringServletContainerInitializer : Unsupported major.minor version 52.0 (unable to load class org.springframework.web.SpringServletContainerInitializer)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2576)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:859)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1308)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:186)
at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:157)
at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1631)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1140)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:783)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:307)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5213)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
… 6 more

网上查询A child container failed during start,说是将tomcat的配置中server Options模块中Publish module contexts to separate XML files打勾。照做之后tomcat启动起来了,但是还是报错:

严重: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ssm-crud]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:621)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1835)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.UnsupportedClassVersionError: org/springframework/web/SpringServletContainerInitializer : Unsupported major.minor version 52.0 (unable to load class org.springframework.web.SpringServletContainerInitializer)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2576)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:859)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1308)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:186)
at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:157)
at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1631)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1140)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:783)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:307)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5213)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
… 10 more

十一月 08, 2017 11:04:33 上午 org.apache.catalina.startup.HostConfig deployDescriptor
严重: Error deploying configuration descriptor D:\eclipse\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\ssm-crud.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ssm-crud]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:757)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:621)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1835)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

根据错误信息Unsupported major.minor version 52.0查到说是jdk版本集成tomcat版本太高,需要改低一些,于是检查了我的jdk,我jdk用的1.7的,Tomcat用的8.0的,没有问题。忙了半天也不知道改哪里,突然就想到是不是我集成的jar包版本的问题呢?因为我在配置的时候所有的jar包都选择的最新版本的。原本jar包配置如下:
关于Unsupported major.minor version 52.0 错误的解决方案_第1张图片

**修改了spring的三个jar包,将5.0.1改成了4.3.12还将Publish module contexts to separate XML files打勾的去掉了,启动tomcat成功。
总结如下:我们在引入jar包时,有些人喜欢引入最新的jar包,尤其是刚开始接触的这块的人更明显,因为越新功能越强大嘛,但是好多jar包都依赖于jdk,我们并不知道最新的jar包依赖的是jdk的那个版本,所以选择是需要慎重,如果你遇到了上面的问题,在确定jdk版本没问题后,可以看看你引入的jar包的版本是不是过高了。**

Created By 李晓晴

关于Unsupported major.minor version 52.0 错误的解决方案_第2张图片

你可能感兴趣的:(java)