使用 Spring 3.2.x 時, 只要一讀取
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
就會出現下面Exception
原來是因為我Tomcat使用了JDK1.8
若要用1.8, Spring必須upgrade成4才會支援1.8的byte code format
--
ERROR [org.springframework.web.context.ContextLoader] - <Context initialization failed>
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)
嚴重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
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)
2014-10-26 22:00:13,255 WARN [org.springframework.web.context.support.XmlWebApplicationContext] - <Exception thrown from ApplicationListener handling ContextClosedEvent>
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:347)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
[org.springframework.web.context.support.XmlWebApplicationContext] - <Exception thrown from LifecycleProcessor on context close>
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1057)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)