Spring上下文初始化失败于java.lang。在部署到tomcat 8.0.21和java 8时出现了IllegalArgumentException。

时间:2022-11-20 20:52:00

My web application runs fine on JDK 1.7 but crashes on 1.8 with the following exception(during application server startup-tomcat 8).I am using Spring version: 3.2.2.RELEASE.

我的web应用程序在JDK 1.7上运行良好,但是在1.8上崩溃,有以下异常(在应用服务器startup-tomcat 8中),我使用Spring版本:3.2.2.RELEASE。

I compiled to target 1.7, I only changed the runtime to be java 8.

我编译为目标1.7,只将运行时更改为java 8。

10-Apr-2015 10:50:44.250 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath
10-Apr-2015 10:50:44.266 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
10-Apr-2015 10:50:51.832 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class com.nrift.finch.inf.startup.web.OperationContextListener
 java.lang.IllegalStateException: application init failed
    at com.nrift.finch.inf.startup.web.OperationContextListener.contextInitialized(OperationContextListener.java:85)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4728)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5166)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:940)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1738)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.core.LocalVariableTableParameterNameDiscoverer.inspectClass(LocalVariableTableParameterNameDiscoverer.java:110)
    at org.springframework.core.LocalVariableTableParameterNameDiscoverer.getParameterNames(LocalVariableTableParameterNameDiscoverer.java:85)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:193)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1051)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:955)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:629)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1051)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:955)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at com.nrift.finch.inf.startup.StartupConfigurations$DefaultStartupConfiguration.getConfigurationContext(StartupConfigurations.java:168)
    at com.nrift.finch.inf.startup.Operation.<init>(Operation.java:155)
    at com.nrift.finch.inf.startup.Operation.<init>(Operation.java:127)
    at com.nrift.finch.inf.startup.Operation.init(Operation.java:176)
    at com.nrift.finch.inf.startup.web.OperationContextListener.contextInitialized(OperationContextListener.java:81)
    ... 13 more

10-Apr-2015 10:50:52.159 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
10-Apr-2015 10:50:52.643 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
10-Apr-2015 10:50:52.643 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()

1 个解决方案

#1


11  

Spring3 is not supported for Java8. Java8 support is only available from Spring 4.0.3 onwards. For more info.

Java8不支持Spring3。Java8支持仅从Spring 4.0.3开始提供。更多信息。

This is because spring uses a lot of asm and cglib which directly work at generating and manipulating bytecode. And moving from java 7 -> 8, there can obviously changes in the source and at bytecode which might not go well with cglib.

这是因为spring使用了大量的asm和cglib,它们直接用于生成和操作字节码。从java 7 - >8开始,在源代码和字节码中有明显的变化,这可能与cglib不太匹配。

#1


11  

Spring3 is not supported for Java8. Java8 support is only available from Spring 4.0.3 onwards. For more info.

Java8不支持Spring3。Java8支持仅从Spring 4.0.3开始提供。更多信息。

This is because spring uses a lot of asm and cglib which directly work at generating and manipulating bytecode. And moving from java 7 -> 8, there can obviously changes in the source and at bytecode which might not go well with cglib.

这是因为spring使用了大量的asm和cglib,它们直接用于生成和操作字节码。从java 7 - >8开始,在源代码和字节码中有明显的变化,这可能与cglib不太匹配。