title: Spring IllegalStateExceptions when upgrading to Java 8
body: <p>Quite new to this but I'm trying to upgrade to java 8 from java 6.</p>
  
  <p>I built using java 8. It compiled fine but got some server errors when I ran the application. I read that java 8 required spring to be upgraded to version 4 so I followed <a href="http://xpadro.blogspot.ie/2014/01/migrating-spring-mvc-restful-web.html" rel="nofollow">this</a> guide to do such. After a bit of heartache everything is back compiling but I am still getting errors. I know it is still a versioning issue but I'm not sure where to start with trying to figure out where...</p>
  
  <p>I am running tomcat 6.0.33, java 8 (hopefully), spring 4(also hopefully) and it is a RESTful web service.</p>
  
  <p>I have updated tomcat to run java 8 and my path variables are up to date.</p>
  
  <p>Merci buckets! Here's the full trace.</p>
  
  <pre><code>2015-01-07 14:53:54.270 ERROR: org.springframework.web.context.ContextLoader - Context initialization failed
  java.lang.IllegalArgumentException
      at org.springframework.asm.ClassReader.&lt;init&gt;(Unknown Source)
      at org.springframework.asm.ClassReader.&lt;init&gt;(Unknown Source)
      at org.springframework.asm.ClassReader.&lt;init&gt;(Unknown Source)
      at org.springframework.core.type.classreading.SimpleMetadataReader.&lt;init&gt;(SimpleMetadataReader.java:52)
      at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
      at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
      at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76)
      at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:70)
      at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:253)
      at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)
      at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
      at org.springframework.context.support.AbstractApplicationContext.__refresh(AbstractApplicationContext.java:461)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java)
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
      at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
      at org.apache.catalina.core.StandardService.start(StandardService.java:525)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
  Jan 07, 2015 2:53:54 PM org.apache.catalina.core.StandardContext start
  SEVERE: Error listenerStart
  Jan 07, 2015 2:53:54 PM org.apache.catalina.core.StandardContext start
  SEVERE: Context [] startup failed due to previous errors
  2015-01-07 14:53:54.345 INFO : org.springframework.web.context.support.XmlWebApplicationContext - Closing Root WebApplicationContext: startup date [Wed Jan 07 14:53:45 GMT 2015]; root of context hierarchy
  2015-01-07 14:53:54.354 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 [Wed Jan 07 14:53:45 GMT 2015]; root of context hierarchy
      at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:347)
      at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
      at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1049)
      at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)
      at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:558)
      at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)
      at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4245)
      at org.apache.catalina.core.StandardContext.__stop(StandardContext.java:4886)
      at org.apache.catalina.core.StandardContext.stop(StandardContext.java)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4750)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
      at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
      at org.apache.catalina.core.StandardService.start(StandardService.java:525)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
  2015-01-07 14:53:54.357 WARN : 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 [Wed Jan 07 14:53:45 GMT 2015]; root of context hierarchy
      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)
      at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:558)
      at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:143)
      at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4245)
      at org.apache.catalina.core.StandardContext.__stop(StandardContext.java:4886)
      at org.apache.catalina.core.StandardContext.stop(StandardContext.java)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4750)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
      at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
      at org.apache.catalina.core.StandardService.start(StandardService.java:525)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
  </code></pre>
  
  <p>Edit:
  So I tried to remove asm from my project as such</p>
  
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
              &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-asm&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;!-- &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-asm&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt; --&gt;
  </code></pre>
  
  <p>But I am still getting the </p>
  
  <pre><code>ERROR: org.springframework.web.context.ContextLoader - Context initialization failed java.lang.IllegalArgumentException at org.springframework.asm.ClassReader.&lt;init&gt;(Unknown Source)...
  </code></pre>
  
  <p>I am also now using tomcat 8</p>
  
  <p>I looked through all of the children poms and added exclusions to anything that was referencing asm. 
  I have no idea why this is being called... </p>
  
  <p>Does anyone have any ideas?</p>
  
  <p>Edit 2:
  After running mvn dependency:tree here are the asm related parts of the output (the output itself was massive so I don't want to post it all)</p>
  
  <pre><code>[INFO] com.gustavo:maven-j2as-plugin:maven-plugin:1.0.0-SNAPSHOT
  [INFO] +- org.apache.maven:maven-plugin-api:jar:3.1.0:compile
  [INFO] |  +- org.apache.maven:maven-model:jar:3.1.0:compile
  [INFO] |  |  \- org.codehaus.plexus:plexus-utils:jar:3.0.10:compile
  [INFO] |  +- org.apache.maven:maven-artifact:jar:3.1.0:compile
  [INFO] |  \- org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M2a:compile
  [INFO] |     +- javax.enterprise:cdi-api:jar:1.0:compile
  [INFO] |     |  +- javax.annotation:jsr250-api:jar:1.0:compile
  [INFO] |     |  \- javax.inject:javax.inject:jar:1:compile
  [INFO] |     +- org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0:compile
  [INFO] |     +- org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.0.0.M2a:compile
  [INFO] |     |  \- asm:asm:jar:3.3.1:compile
  
  [INFO] com.gustavo:maven-j2as-plugin:maven-plugin:1.0.0-SNAPSHOT
  [INFO] +- org.apache.maven:maven-plugin-api:jar:3.1.0:compile
  [INFO] |  +- org.apache.maven:maven-model:jar:3.1.0:compile
  [INFO] |  |  \- org.codehaus.plexus:plexus-utils:jar:3.0.10:compile
  [INFO] |  +- org.apache.maven:maven-artifact:jar:3.1.0:compile
  [INFO] |  \- org.eclipse.sisu:org.eclipse.sisu.plexus:jar:0.0.0.M2a:compile
  [INFO] |     +- javax.enterprise:cdi-api:jar:1.0:compile
  [INFO] |     |  +- javax.annotation:jsr250-api:jar:1.0:compile
  [INFO] |     |  \- javax.inject:javax.inject:jar:1:compile
  [INFO] |     +- org.sonatype.sisu:sisu-guice:jar:no_aop:3.1.0:compile
  [INFO] |     +- org.eclipse.sisu:org.eclipse.sisu.inject:jar:0.0.0.M2a:compile
  [INFO] |     |  \- asm:asm:jar:3.3.1:compile
  
  [INFO] +- cglib:cglib:jar:2.2:compile
  [INFO] |  \- asm:asm:jar:3.1:compile
  
  [INFO] +- cglib:cglib:jar:2.2:compile
  [INFO] |  \- asm:asm:jar:3.1:compile
  
  [INFO] +- cglib:cglib:jar:2.2:compile
  [INFO] |  \- asm:asm:jar:3.1:compile
  
  [INFO] +- cglib:cglib:jar:2.2:compile
  [INFO] |  \- asm:asm:jar:3.1:compile
  
  [INFO] |  +- cglib:cglib:jar:2.2:compile
  [INFO] |  |  \- asm:asm:jar:3.1:compile
  
  [INFO] |  +- cglib:cglib:jar:2.2:compile
  [INFO] |  |  \- asm:asm:jar:3.1:compile
  
  [INFO] |  +- xml-resolver:xml-resolver:jar:1.2:compile
  [INFO] |  +- asm:asm:jar:3.3:compile
  
  [INFO] |  +- xml-resolver:xml-resolver:jar:1.2:compile
  [INFO] |  +- asm:asm:jar:3.3:compile
  
  [INFO] +- cglib:cglib:jar:2.2:runtime
  [INFO] |  \- asm:asm:jar:3.1:compile
  
  [INFO] +- cglib:cglib:jar:2.2:runtime
  [INFO] |  \- asm:asm:jar:3.1:compile
  </code></pre>
  
  <p>I have 30 modules so I guess 12 of them still have a dependency on asm :/ </p>