spring - Error creating bean with name 'cxf' defined in class path resource [META-INF/cxf/cxf.xml] -
we using spring 3.0.5 , cxf 2.7.5. writing jmock mock data , test locally. initialzing variables spring config (appcontext.xml) entries this:
<import resource="classpath:meta-inf/cxf/cxf.xml" /> <import resource="classpath:meta-inf/cxf/cxf-servlet.xml" />
my junit class has code:
applicationcontext = new classpathxmlapplicationcontext(new string[] {"/spring/applicationcontext.xml"});
while running junit test file, getting error:
org.springframework.beans.factory.beancreationexception: error creating bean name 'cxf' defined in class path resource [meta-inf/cxf/cxf.xml]: initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'producerclient': instantiation of bean failed; nested exception org.springframework.beans.beaninstantiationexception: not instantiate bean class [org.apache.cxf.jaxws.spring.jaxwsproxyfactorybeandefinitionparser$jaxwsspringclientproxyfactorybean]: constructor threw exception; nested exception java.lang.noclassdeffounderror: javax/wsdl/wsdlexception @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:532) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:461) @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:295) @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:223) @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:292) @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:194) @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:626) @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:932) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:479) @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:139) @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplicationcontext.java:93) @ com.amfam.api.producer.web.controller.test.producercontrollertest.setup(producercontrollertest.java:56) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) @ java.lang.reflect.method.invoke(method.java:597) @ org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:44) @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:15) @ org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:41) @ org.junit.internal.runners.statements.runbefores.evaluate(runbefores.java:27) @ org.junit.internal.runners.statements.runafters.evaluate(runafters.java:31) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:73) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:46) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:180) @ org.junit.runners.parentrunner.access$000(parentrunner.java:41) @ org.junit.runners.parentrunner$1.evaluate(parentrunner.java:173) @ org.junit.internal.runners.statements.runbefores.evaluate(runbefores.java:28) @ org.junit.internal.runners.statements.runafters.evaluate(runafters.java:31) @ org.junit.runners.parentrunner.run(parentrunner.java:220) @ org.eclipse.jdt.internal.junit4.runner.junit4testreference.run(junit4testreference.java:50) @ org.eclipse.jdt.internal.junit.runner.testexecution.run(testexecution.java:38) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:467) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:683) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.run(remotetestrunner.java:390) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.main(remotetestrunner.java:197) caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'producerclient': instantiation of bean failed; nested exception org.springframework.beans.beaninstantiationexception: not instantiate bean class [org.apache.cxf.jaxws.spring.jaxwsproxyfactorybeandefinitionparser$jaxwsspringclientproxyfactorybean]: constructor threw exception; nested exception java.lang.noclassdeffounderror: javax/wsdl/wsdlexception @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.instantiatebean(abstractautowirecapablebeanfactory.java:1013) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbeaninstance(abstractautowirecapablebeanfactory.java:959) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.getsingletonfactorybeanfortypecheck(abstractautowirecapablebeanfactory.java:783) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.gettypeforfactorybean(abstractautowirecapablebeanfactory.java:713) @ org.springframework.beans.factory.support.abstractbeanfactory.istypematch(abstractbeanfactory.java:523) @ org.springframework.beans.factory.support.defaultlistablebeanfactory.dogetbeannamesfortype(defaultlistablebeanfactory.java:357) @ org.springframework.beans.factory.support.defaultlistablebeanfactory.getbeannamesfortype(defaultlistablebeanfactory.java:335) @ org.springframework.beans.factory.support.defaultlistablebeanfactory.getbeannamesfortype(defaultlistablebeanfactory.java:322) @ org.springframework.beans.factory.support.defaultlistablebeanfactory.getbean(defaultlistablebeanfactory.java:260) @ org.springframework.context.support.abstractapplicationcontext.getbean(abstractapplicationcontext.java:1125) @ org.apache.cxf.bus.spring.busapplicationcontextresourceresolver.resolve(busapplicationcontextresourceresolver.java:72) @ org.apache.cxf.resource.defaultresourcemanager.findresource(defaultresourcemanager.java:113) @ org.apache.cxf.resource.defaultresourcemanager.resolveresource(defaultresourcemanager.java:62) @ org.apache.cxf.common.injection.resourceinjector.resolveresource(resourceinjector.java:442) @ org.apache.cxf.common.injection.resourceinjector.visitmethod(resourceinjector.java:229) @ org.apache.cxf.common.annotation.annotationprocessor.processmethods(annotationprocessor.java:89) @ org.apache.cxf.common.annotation.annotationprocessor.accept(annotationprocessor.java:72) @ org.apache.cxf.common.injection.resourceinjector.inject(resourceinjector.java:118) @ org.apache.cxf.common.injection.resourceinjector.inject(resourceinjector.java:112) @ org.apache.cxf.bus.extension.extensionmanagerimpl.loadandregister(extensionmanagerimpl.java:225) @ org.apache.cxf.bus.extension.extensionmanagerimpl.getbeansoftype(extensionmanagerimpl.java:305) @ org.apache.cxf.bus.spring.springbeanlocator.getbeansoftype(springbeanlocator.java:145) @ org.apache.cxf.bus.managers.cxfbuslifecyclemanager.initcomplete(cxfbuslifecyclemanager.java:80) @ org.apache.cxf.bus.cxfbusimpl.initialize(cxfbusimpl.java:208) @ org.apache.cxf.bus.spring.springbus.setapplicationcontext(springbus.java:101) @ org.springframework.context.support.applicationcontextawareprocessor.invokeawareinterfaces(applicationcontextawareprocessor.java:117) @ org.springframework.context.support.applicationcontextawareprocessor.postprocessbeforeinitialization(applicationcontextawareprocessor.java:92) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.applybeanpostprocessorsbeforeinitialization(abstractautowirecapablebeanfactory.java:399) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1481) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:524) ... 34 more caused by: org.springframework.beans.beaninstantiationexception: not instantiate bean class [org.apache.cxf.jaxws.spring.jaxwsproxyfactorybeandefinitionparser$jaxwsspringclientproxyfactorybean]: constructor threw exception; nested exception java.lang.noclassdeffounderror: javax/wsdl/wsdlexception @ org.springframework.beans.beanutils.instantiateclass(beanutils.java:163) @ org.springframework.beans.factory.support.simpleinstantiationstrategy.instantiate(simpleinstantiationstrategy.java:87) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.instantiatebean(abstractautowirecapablebeanfactory.java:1006) ... 63 more caused by: java.lang.noclassdeffounderror: javax/wsdl/wsdlexception @ org.apache.cxf.jaxws.jaxwsclientfactorybean.<init>(jaxwsclientfactorybean.java:38) @ org.apache.cxf.jaxws.jaxwsproxyfactorybean.<init>(jaxwsproxyfactorybean.java:68) @ org.apache.cxf.jaxws.spring.jaxwsproxyfactorybeandefinitionparser$jaxwsspringclientproxyfactorybean.<init>(jaxwsproxyfactorybeandefinitionparser.java:66) @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:39) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:27) @ java.lang.reflect.constructor.newinstance(constructor.java:513) @ org.springframework.beans.beanutils.instantiateclass(beanutils.java:148) ... 65 more
i struck @ stage , not able proceed further..
java.lang.noclassdeffounderror: javax/wsdl/wsdlexception
this problem. need add javax.wsdl api classes test class path.
for example wsdl4j contains class, if you're using maven, try
<dependency> <groupid>wsdl4j</groupid> <artifactid>wsdl4j</artifactid> <version>1.6.3</version> <scope>test</scope> </dependency>
if don't use maven, can download jar this link.
Comments
Post a Comment