title: Spring Junit Test cases exceution failed in Jenkins Environment : java.lang.IllegalStateException: Failed to load ApplicationContext
body: <p>My Junit test cases are failed in Jenkins environment. Please find below exception log in console. It is working perfectly in eclipse environment. common_rbac_test_applicationContext.xml is part of application ear file in one jar file</p>
  
  <pre><code>09:06:30 Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 7.951 sec &lt;&lt;&lt; FAILURE!
  09:06:30 t1_create_pending_account(com.cisco.services.entacc.service.TestEnterpriseAccountService)  Time elapsed: 4.677 sec  &lt;&lt;&lt; ERROR!
  09:06:30 java.lang.IllegalStateException: Failed to load ApplicationContext
  09:06:30    at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99)
  09:06:30    at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:122)
  09:06:30    at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:105)
  09:06:30    at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:74)
  09:06:30    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:312)
  09:06:30    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
  09:06:30    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
  09:06:30    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
  09:06:30    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:284)
  09:06:30    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
  09:06:30    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
  09:06:30    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
  09:06:30    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
  09:06:30    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
  09:06:30    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
  09:06:30    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
  09:06:30    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
  09:06:30    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
  09:06:30    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
  09:06:30    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
  09:06:30    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
  09:06:30    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
  09:06:30    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
  09:06:30    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  09:06:30    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  09:06:30    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  09:06:30    at java.lang.reflect.Method.invoke(Method.java:606)
  09:06:30    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
  09:06:30    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
  09:06:30    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
  09:06:30    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
  09:06:30    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
  09:06:30 Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:common_rbac_test_applicationContext.xml]
  09:06:30 Offending resource: class path resource [ea_test_applicationContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/apps/dftjenkins/jenkins_node/workspace/IT-CITS-Connected_Software/SWSC/MASTER/CSWCOM/target/test-classes/com/cisco/services/entacc/service/TestEnterpriseAccountService.class]; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class
  09:06:30    at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
  09:06:30    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
  09:06:30    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
  09:06:30    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:246)
  09:06:30    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:197)
  09:06:30    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:182)
  09:06:30    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)
  09:06:30    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)
  09:06:30    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
  09:06:30    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
  09:06:30    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
  09:06:30    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
  09:06:30    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
  09:06:30    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
  09:06:30    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
  09:06:30    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243)
  09:06:30    at org.springframework.test.context.support.AbstractGenericContextLoader.loadBeanDefinitions(AbstractGenericContextLoader.java:233)
  09:06:30    at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:117)
  09:06:30    at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
  09:06:30    at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:100)
  09:06:30    at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:248)
  09:06:30    at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContextInternal(CacheAwareContextLoaderDelegate.java:64)
  09:06:30    at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:91)
  09:06:30    ... 31 more
  09:06:30 Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/apps/dftjenkins/jenkins_node/workspace/IT-CITS-Connected_Software/SWSC/MASTER/CSWCOM/target/test-classes/com/cisco/services/entacc/service/TestEnterpriseAccountService.class]; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class
  09:06:30    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:290)
  09:06:30    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242)
  09:06:30    at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84)
  09:06:30    at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
  09:06:30    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438)
  09:06:30    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)
  09:06:30    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:185)
  09:06:30    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)
  09:06:30    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)
  09:06:30    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
  09:06:30    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
  09:06:30    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
  09:06:30    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
  09:06:30    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
  09:06:30    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
  09:06:30    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:240)
  09:06:30    ... 50 more
  09:06:30 Caused by: java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class
  09:06:30    at java.lang.ClassLoader.defineClass1(Native Method)
  09:06:30    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
  09:06:30    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
  09:06:30    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
  09:06:30    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
  09:06:30    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
  09:06:30    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
  09:06:30    at java.security.AccessController.doPrivileged(Native Method)
  09:06:30    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
  09:06:30    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
  09:06:30    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
  09:06:30    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
  09:06:30    at java.lang.ClassLoader.defineClass1(Native Method)
  09:06:30    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
  09:06:30    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
  09:06:30    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
  09:06:30    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
  09:06:30    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
  09:06:30    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
  09:06:30    at java.security.AccessController.doPrivileged(Native Method)
  09:06:30    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
  09:06:30    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
  09:06:30    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
  09:06:30    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
  09:06:30    at org.springframework.core.type.classreading.SimpleMetadataReader.&lt;init&gt;(SimpleMetadataReader.java:63)
  09:06:30    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
  09:06:30    at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
  09:06:30    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:266)
  09:06:30    ... 65 more
  09:06:30 
  </code></pre>
  
  <p>Can somebody please help what is wrong here.</p>
  
  <p>Thanks</p>