camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <ch...@die-schneider.net>
Subject Problem using a CamelTransportFactory from a junit 4 unit test or together with <context:annotation-config/>
Date Mon, 26 Oct 2009 17:56:15 GMT
Hi all,

I recently tried to convert my unit tests to junit 4 using the new Spring test framework.

Since then I get the following exception when calling the test.
Error creating bean with name 'org.apache.camel.component.cxf.transport.CamelTransportFactory#0':
Injection of resource methods failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No matching bean of type [java.lang.String] found for dependency [collection of java.lang.String]:
expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency
annotations: {}

The same happens when I activate /<context:annotation-config/>/

I think it has to do with autowiring. Do you have any idea what goes wrong here and how I
can fix it?

Greetings

Christian

---


17:45:16,928 INFO  org.springframework.test.context.TestContextManager retrieveTestExecutionListeners
- @TestExecutionListeners is not present for class [class net.enbw.endur.ServiceTest]: using
defaults.
17:45:17,116 INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
- Loading XML bean definitions from class path resource [applicationContext.xml]
17:45:17,350 INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
- Loading XML bean definitions from class path resource [META-INF/cxf/cxf.xml]
17:45:17,397 INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
- Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-soap.xml]
17:45:17,444 INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
- Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-camel.xml]
17:45:17,553 INFO  org.apache.camel.spring.handler.CamelNamespaceHandler init - camel-osgi.jar
not detected in classpath
17:45:18,412 INFO  org.springframework.context.support.GenericApplicationContext prepareRefresh
- Refreshing org.springframework.context.support.GenericApplicationContext@fd918a: display
name [org.springframework.context.support.GenericApplicationContext@fd918a]; startup date
[Mon Oct 26 17:45:18 CET 2009]; root of context hierarchy
17:45:18,412 INFO  org.springframework.context.support.GenericApplicationContext obtainFreshBeanFactory
- Bean factory for application context [org.springframework.context.support.GenericApplicationContext@fd918a]:
org.springframework.beans.factory.support.DefaultListableBeanFactory@ef9d00
17:45:59,628 INFO  org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
loadProperties - Loading properties file from class path resource [jms.properties]
17:46:13,767 INFO  org.springframework.context.support.GenericApplicationContext postProcessAfterInitialization
- Bean 'cxf' is not eligible for getting processed by all BeanPostProcessors (for example:
not eligible for auto-proxying)
17:46:13,829 INFO  org.apache.camel.impl.DefaultCamelContext <init> - JMX enabled. Using
InstrumentationLifecycleStrategy.
17:46:14,001 INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
- Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@ef9d00:
defining beans [cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.camel.component.cxf.transport.CamelTransportFactory#0,configProps,appModule,serviceImpl,customerServiceEndpoint,customerService.proxyFactory,customerService,template,consumerTemplate,camelContext:beanPostProcessor,camelContext,jms,jmsConfiguration,jmsConnectionFactory,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor];
root of factory hierarchy
26.10.2009 17:46:17 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
INFO: Creating Service {http://examples.etg.services.enbw.net/}CustomerService from class
net.enbw.services.etg.examples.customerservice.CustomerServiceV1
17:46:30,609 INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory destroySingletons
- Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@ef9d00:
defining beans [cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.camel.component.cxf.transport.CamelTransportFactory#0,configProps,appModule,serviceImpl,customerServiceEndpoint,customerService.proxyFactory,customerService,template,consumerTemplate,camelContext:beanPostProcessor,camelContext,jms,jmsConfiguration,jmsConnectionFactory,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor];
root of factory hierarchy
17:46:30,609 ERROR org.springframework.test.context.TestContextManager prepareTestInstance
- Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1639ff]
to prepare test instance [net.enbw.endur.ServiceTest@1399671]
java.lang.IllegalStateException: Failed to load ApplicationContext
	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:203)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:93)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:130)
	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'appModule' defined in class path resource [applicationContext.xml]: Cannot resolve reference
to bean 'customerService' while setting bean property 'customerService'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'customerService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.apache.camel.component.cxf.transport.CamelTransportFactory#0':
Injection of resource methods failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No matching bean of type [java.lang.String] found for dependency [collection of java.lang.String]:
expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency
annotations: {}
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:42)
	at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:173)
	at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:199)
	... 16 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'customerService': FactoryBean threw exception on object creation; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.camel.component.cxf.transport.CamelTransportFactory#0':
Injection of resource methods failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No matching bean of type [java.lang.String] found for dependency [collection of java.lang.String]:
expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency
annotations: {}
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:127)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:116)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:98)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1285)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:217)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
	... 35 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'org.apache.camel.component.cxf.transport.CamelTransportFactory#0': Injection of resource
methods failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No matching bean of type [java.lang.String] found for dependency [collection of java.lang.String]:
expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency
annotations: {}
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:305)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:998)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
	at org.apache.cxf.configuration.spring.AbstractSpringBeanMap.get(AbstractSpringBeanMap.java:136)
	at org.apache.cxf.configuration.spring.AbstractSpringBeanMap$Entry.getValue(AbstractSpringBeanMap.java:209)
	at org.apache.cxf.transport.DestinationFactoryManagerImpl.getDestinationFactoryForUri(DestinationFactoryManagerImpl.java:132)
	at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:240)
	at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:146)
	at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:52)
	at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:102)
	at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:115)
	at org.apache.cxf.jaxws.spring.JaxWsProxyFactoryBeanDefinitionParser$JAXWSSpringClientProxyFactoryBean.getObject(JaxWsProxyFactoryBeanDefinitionParser.java:74)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:121)
	... 43 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean
of type [java.lang.String] found for dependency [collection of java.lang.String]: expected
at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:
{}
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:726)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:571)
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:431)
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409)
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:537)
	at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:192)
	at org.springframework.beans.factory.annotation.InjectionMetadata.injectMethods(InjectionMetadata.java:117)
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:302)
	... 64 more

-- 

Christian Schneider
---
http://www.liquid-reality.de



Mime
View raw message