gpt4 book ai didi

java - BeanCreationException - 以前工作过,现在不再工作

转载 作者:行者123 更新时间:2023-12-01 18:18:15 30 4
gpt4 key购买 nike

我有一个在本地运行的项目,但是当我尝试将其部署到 tomcat 7 服务器时,出现以下异常:

ERROR: [Feb-05 16:39:30,240] web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Invocation of init method failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [se.kth.example-project.webservices.rest.CategoryController] for bean with name 'categoryController' defined in file [/proj/webdocs/test-project/root/example-project/WEB-INF/classes/se/kth/example-project/webservices/rest/CategoryController.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: se/kth/example-project/webservices/rest/CategoryController : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.webservices.rest.CategoryController)
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [se.kth.example-project.webservices.rest.CategoryController] for bean with name 'categoryController' defined in file [/proj/webdocs/test-project/root/example-project/WEB-INF/classes/se/kth/example-project/webservices/rest/CategoryController.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: se/kth/example-project/webservices/rest/CategoryController : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.webservices.rest.CategoryController)
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [se.kth.example-project.webservices.rest.CheopsController] for bean with name 'cheopsController' defined in file [/proj/webdocs/test-project/root/example-project/WEB-INF/classes/se/kth/example-project/webservices/rest/CheopsController.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: se/kth/example-project/webservices/rest/CheopsController : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.webservices.rest.CheopsController)
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [se.kth.example-project.webservices.rest.StatusController] for bean with name 'statusController' defined in file [/proj/webdocs/test-project/root/example-project/WEB-INF/classes/se/kth/example-project/webservices/rest/StatusController.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: se/kth/example-project/webservices/rest/StatusController : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.webservices.rest.StatusController)
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [se.kth.example-project.webservices.rest.SurveyController] for bean with name 'surveyController' defined in file [/proj/webdocs/test-project/root/example-project/WEB-INF/classes/se/kth/example-project/webservices/rest/SurveyController.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: se/kth/example-project/webservices/rest/SurveyController : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.webservices.rest.SurveyController)
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [se.kth.example-project.webservices.rest.ThresholdController] for bean with name 'thresholdController' defined in file [/proj/webdocs/test-project/root/example-project/WEB-INF/classes/se/kth/example-project/webservices/rest/ThresholdController.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: se/kth/example-project/webservices/rest/ThresholdController : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.webservices.rest.ThresholdController)
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [se.kth.example-project.services.impl.CategoryServiceImpl] for bean with name 'categoryServiceImpl' defined in file [/proj/webdocs/test-project/root/example-project/WEB-INF/classes/se/kth/example-project/services/impl/CategoryServiceImpl.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: se/kth/example-project/services/impl/CategoryServiceImpl : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.services.impl.CategoryServiceImpl)
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [se.kth.example-project.services.impl.CheopsServiceImpl] for bean with name 'cheopsServiceImpl' defined in file [/proj/webdocs/test-project/root/example-project/WEB-INF/classes/se/kth/example-project/services/impl/CheopsServiceImpl.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: se/kth/example-project/services/impl/CheopsServiceImpl : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.services.impl.CheopsServiceImpl)
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [se.kth.example-project.services.impl.StatusServiceImpl] for bean with name 'statusServiceImpl' defined in file [/proj/webdocs/test-project/root/example-project/WEB-INF/classes/se/kth/example-project/services/impl/StatusServiceImpl.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: se/kth/example-project/services/impl/StatusServiceImpl : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.services.impl.StatusServiceImpl)
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [se.kth.example-project.services.impl.ThresholdServiceImpl] for bean with name 'thresholdServiceImpl' defined in file [/proj/webdocs/test-project/root/example-project/WEB-INF/classes/se/kth/example-project/services/impl/ThresholdServiceImpl.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: se/kth/example-project/services/impl/ThresholdServiceImpl : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.services.impl.ThresholdServiceImpl)
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [se.kth.example-project.services.SurveyService] for bean with name 'surveyService' defined in file [/proj/webdocs/test-project/root/example-project/WEB-INF/classes/se/kth/example-project/services/SurveyService.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: se/kth/example-project/services/SurveyService : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.services.SurveyService)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
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:546)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:525)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1359)
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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1500)
at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:252)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [se.kth.example-project.webservices.rest.CategoryController] for bean with name 'categoryController' defined in file [/proj/webdocs/test-project/root/example-project/WEB-INF/classes/se/kth/example-project/webservices/rest/CategoryController.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: se/kth/example-project/webservices/rest/CategoryController : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.webservices.rest.CategoryController)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1330)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:594)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1396)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:385)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:362)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:348)
at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:1051)
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:119)
at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:103)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:126)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
... 45 more
Caused by: java.lang.UnsupportedClassVersionError: se/kth/example-project/webservices/rest/CategoryController : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.webservices.rest.CategoryController)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2737)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1124)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:247)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:395)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1348)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1319)
... 56 more
Related cause:
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [se.kth.example-project.webservices.rest.CategoryController] for bean with name 'categoryController' defined in file [/proj/webdocs/test-project/root/example-project/WEB-INF/classes/se/kth/example-project/webservices/rest/CategoryController.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: se/kth/example-project/webservices/rest/CategoryController : Unsupported major.minor version 52.0 (unable to load class se.kth.example-project.webservices.rest.CategoryController)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1330)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:594)

这是什么原因造成的?我没有编辑任何内容..它在本地工作,但未部署...

编辑 1

添加了完整的堆栈跟踪

编辑2

这不是版本不匹配错误,因为我已将 IDE 上的 tomcat 版本更改为 6.0(这也是我尝试部署到的服务器上的 tomcat 版本)。请帮忙..

最佳答案

这表明类不兼容。您应该确保客户端具有与服务器相同版本的类。如果你在 Google 上搜索“不支持的主要次要版本”或“Java 不支持的主要次要版本”,你会得到很多结果(也来自 SO)。

另请参阅:

How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version

关于java - BeanCreationException - 以前工作过,现在不再工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28348353/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com