Maven spring3.2.3.release ActiveMq5.9 caused By:java.lang.NoSuchFieldError:NULL

Source: Internet
Author: User

In the process of using maven+spring3.2.3.release+activemq5.9, when unit tests occur, the following error occurs:

Java.lang.ExceptionInInitializerError
At Sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native method)
At Sun.reflect.NativeConstructorAccessorImpl.newInstance (nativeconstructoraccessorimpl.java:39)
At Sun.reflect.DelegatingConstructorAccessorImpl.newInstance (delegatingconstructoraccessorimpl.java:27)
At Java.lang.reflect.Constructor.newInstance (constructor.java:513)
At Org.junit.runners.BlockJUnit4ClassRunner.createTest (blockjunit4classrunner.java:187)
At Org.junit.runners.blockjunit4classrunner$1.runreflectivecall (blockjunit4classrunner.java:236)
At Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:15)
At Org.junit.runners.BlockJUnit4ClassRunner.methodBlock (blockjunit4classrunner.java:233)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:68)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:47)
At Org.junit.runners.parentrunner$3.run (parentrunner.java:231)
At Org.junit.runners.parentrunner$1.schedule (parentrunner.java:60)
At Org.junit.runners.ParentRunner.runChildren (parentrunner.java:229)
At org.junit.runners.parentrunner.access$000 (parentrunner.java:50)
At Org.junit.runners.parentrunner$2.evaluate (parentrunner.java:222)
At Org.junit.runners.ParentRunner.run (parentrunner.java:300)
At Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (junit4testreference.java:50)
At Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:467)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:683)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:390)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:197)
caused by:org.springframework.beans.factory.BeanCreationException:Error creating bean with Name ' jmsfactory ' defined In class path resource [Applicationcontext-jms.xml]: Cannot create inner bean ' ORG.APACHE.ACTIVEMQ.ACTIVEMQCONNECTIONFACTORY#1A52FDF ' of type [org.apache.activemq.ActiveMQConnectionFactory] While setting beans property ' ConnectionFactory '; Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' ORG.APACHE.ACTIVEMQ.ACTIVEMQCONNECTIONFACTORY#1A52FDF ' defined in class path resource [Applicationcontext-jms.xml]: Initialization of Bean failed; Nested exception is Java.lang.NoSuchFieldError:NULL
At Org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean ( beandefinitionvalueresolver.java:282)
At Org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary ( beandefinitionvalueresolver.java:121)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues ( abstractautowirecapablebeanfactory.java:1387)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean ( abstractautowirecapablebeanfactory.java:1128)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:519)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:458)
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:895)
At Org.springframework.context.support.AbstractApplicationContext.refresh (abstractapplicationcontext.java:425)
At Org.springframework.context.support.classpathxmlapplicationcontext.<init> ( classpathxmlapplicationcontext.java:139)
At Org.springframework.context.support.classpathxmlapplicationcontext.<init> ( classpathxmlapplicationcontext.java:93)
At Com.yxtx.plc.mq.jmsconsumerserviceimptest.<clinit> (jmsconsumerserviceimptest.java:14)
... More
caused by:org.springframework.beans.factory.BeanCreationException:Error creating bean with Name ' ORG.APACHE.ACTIVEMQ.ACTIVEMQCONNECTIONFACTORY#1A52FDF ' defined in class path resource [Applicationcontext-jms.xml]: Initialization of Bean failed; Nested exception is Java.lang.NoSuchFieldError:NULL
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:529)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:458)
At Org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean ( beandefinitionvalueresolver.java:271)
... Panax Notoginseng
caused By:java.lang.NoSuchFieldError:NULL
At Org.springframework.expression.typedvalue.<clinit> (typedvalue.java:32)
At Org.springframework.expression.spel.support.StandardEvaluationContext.setRootObject ( STANDARDEVALUATIONCONTEXT.JAVA:88)
At Org.springframework.expression.spel.support.standardevaluationcontext.<init> ( standardevaluationcontext.java:74)
At Org.springframework.context.expression.StandardBeanExpressionResolver.evaluate ( standardbeanexpressionresolver.java:124)
At Org.springframework.beans.factory.support.AbstractBeanFactory.evaluateBeanDefinitionString ( abstractbeanfactory.java:1312)
At Org.springframework.beans.factory.support.BeanDefinitionValueResolver.evaluate ( beandefinitionvalueresolver.java:211)
At Org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary ( beandefinitionvalueresolver.java:183)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues ( abstractautowirecapablebeanfactory.java:1387)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean ( abstractautowirecapablebeanfactory.java:1128)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:519)
... More

After a variety of tests and attempts to finally solve the problem.

Original because: When configuring the Pom file, Spring is configured in front of the activemq, and sometimes the spring is configured in the parent Pom file, and when the ACTIVEMQ is configured in the child pom file, the loading of the class in the Pom file is first loaded, The jar package for the current POM file and its dependent jar package, and then the jar package and its dependent jar packages that load its parent pom file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.