title: Spring annotation configuration java.lang.NoClassDefFoundError: org/objectweb/asm/util/TraceClassVisitor
body: <p>i am trying to run a very simple Spring application with java configuration. i am getting the following exception and i dont understand why. as far as i can tell i have all the required dependencies </p>
  
  <blockquote>
  <pre><code>public static void main(String[] args) 
  {
       System.out.println( "Hello World from main!" );
       ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
       HelloWorld helloWorld = ctx.getBean(HelloWorld.class);
       System.out.println( helloWorld.getMessage() );
  }
  </code></pre>
  </blockquote>
  
  <p>The exception occures at - AnnotationConfigApplicationContext function call</p>
  
  <p>worth mentioning:
  I have the following dependency in my POM.XML file.</p>
  
  <blockquote>
  <pre><code>  &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-asm&lt;/artifactId&gt;
          &lt;version&gt;${org.springframework.version}&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  </blockquote>
  
  <p>And the exception:</p>
  
  <blockquote>
  <pre><code>Exception in thread "main" java.lang.IllegalStateException: Cannot load configuration class: spring.play.springStart.AppConfig
  at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:313)
  at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:197)
  at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681)
  at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:620)
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:446)
  at org.springframework.context.annotation.AnnotationConfigApplicationContext.&lt;init&gt;(AnnotationConfigApplicationContext.java:73)
  at spring.play.springStart.App.main(App.java:14)
  Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/util/TraceClassVisitor
  at net.sf.cglib.core.DebuggingClassWriter.toByteArray(DebuggingClassWriter.java:73)
  at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:26)
  at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
  at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:144)
  at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:116)
  at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
  at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
  at net.sf.cglib.proxy.Enhancer.&lt;clinit&gt;(Enhancer.java:69)
  at org.springframework.context.annotation.ConfigurationClassEnhancer.newEnhancer(ConfigurationClassEnhancer.java:136)
  at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:109)
  at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:303)
  ... 6 more
  Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.util.TraceClassVisitor
  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  ... 17 more
  </code></pre>
  </blockquote>