Does the CouchDB driver configure work without the CamelContext element?
AFAIK the spring property holder can't work within CamelContext[1]
Not sure if the org.ektorp.spring.HttpClientFactoryBean has the spring
property holder.
[1]https://issues.apache.org/jira/browse/CAMEL-1066
Willem
On 12/24/10 1:24 AM, Drew Varner wrote:
All,
Has anyone had any luck using Ektorp's (CouchDB driver) Spring support in
Camel? I am having some problems configuring Ektorp as a Spring service.
Here is my Spring config:
--snip--
<?xml version="1.0" encoding="UTF-8"?>
<!-- Apache license text, blah blah blah ... -->
<!-- Configures the Camel Context-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<util:properties id="couchdbProperties"
location="classpath:couchdb.properties"/>
<bean id="couchDbConnector" class="org.ektorp.impl.StdCouchDbConnector">
<constructor-arg value="customs" />
<constructor-arg>
<bean id="couchDbInstance"
class="org.ektorp.impl.StdCouchDbInstance">
<constructor-arg>
<bean
class="org.ektorp.spring.HttpClientFactoryBean" />
</constructor-arg>
</bean>
</constructor-arg>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<package>com.ninefx.customs.routes</package>
</camelContext>
</beans>
--end snip--
I ripped off a standard couchdb.properties from the online examples and place
it in /src/main/resources of my project, where it will be picked up in the
classpath:
--snip--
host=localhost
port=5984
maxConnections=20
connectionTimeout=1000
socketTimeout=10000
--end snip--
When I try to run my Camel route (that relies on Ektorp in the Spring config) I
get the following output from DEBUG logging:
--snip--
[ main] MainSupport INFO Apache
Camel 2.5.0 starting
[ main] ClassPathXmlApplicationContext INFO
Refreshing
org.springframework.context.support.classpathxmlapplicationcont...@4a79717e:
startup date [Tue Dec 21 12:20:13 EST 2010]; root of context hierarchy
[ main] atchingResourcePatternResolver DEBUG Looking
for matching resources in directory tree
[/Users/varnerac/Documents/workspace/customs-processor/target/classes/META-INF/spring]
[ main] atchingResourcePatternResolver DEBUG Searching
directory
[/Users/varnerac/Documents/workspace/customs-processor/target/classes/META-INF/spring]
for files matching pattern
[/Users/varnerac/Documents/workspace/customs-processor/target/classes/META-INF/spring/*.xml]
[ main] atchingResourcePatternResolver DEBUG Resolved
location pattern [META-INF/spring/*.xml] to resources [file
[/Users/varnerac/Documents/workspace/customs-processor/target/classes/META-INF/spring/camel-context.xml]]
[ main] XmlBeanDefinitionReader INFO Loading
XML bean definitions from file
[/Users/varnerac/Documents/workspace/customs-processor/target/classes/META-INF/spring/camel-context.xml]
[ main] DefaultDocumentLoader DEBUG Using
JAXP provider
[com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]
[ main] PluggableSchemaResolver DEBUG Loading
schema mappings from [META-INF/spring.schemas]
[ main] PluggableSchemaResolver DEBUG Loaded
schema mappings:
{http://camel.apache.org/schema/osgi/camel-osgi.xsd=camel-osgi.xsd,
http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd,
http://camel.apache.org/schema/spring/camel-spring-2.0-M3.xsd=camel-spring.xsd,
http://www.springframework.org/schema/task/spring-task.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd,
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd,
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd,
http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd,
http://camel.apache.org/schema/osgi/camel-osgi-2.0-M1.xsd=camel-osgi.xsd,
http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/fac
tory/xml/spring-beans-3.0.xsd,
http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd,
http://camel.apache.org/schema/spring/camel-spring-2.0.0.xsd=camel-spring.xsd,
http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-3.0.xsd,
http://camel.apache.org/schema/spring/camel-spring-2.2.0.xsd=camel-spring.xsd,
http://camel.apache.org/schema/spring/camel-spring-2.4.0.xsd=camel-spring.xsd,
http://camel.apache.org/schema/spring/camel-spring-2.0-M2.xsd=camel-spring.xsd,
http://camel.apache.org/schema/spring/camel-spring-2.1.0.xsd=camel-spring.xsd,
http://camel.apache.org/schema/spring/camel-spring-2.3.0.xsd=camel-spring.xsd,
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd,
http://camel.apache.org/schema/spring/camel-spring-2.5.0.xsd=camel-spring.xsd,
http://www.springframework.org/schema/beans/spring-beans-3.0
.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd,
http://www.springframework.org/schema/task/spring-task-3.0.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd,
http://camel.apache.org/schema/spring/camel-spring.xsd=camel-spring.xsd,
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd,
http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd,
http://www.springframework.org/schema/tool/spring-tool-3.0.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd,
http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd,
http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd,
http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd,
http://www.
springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd,
http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd,
http://www.springframework.org/schema/jee/spring-jee-3.0.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd,
http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd,
http://camel.apache.org/schema/osgi/camel-osgi-2.2.0.xsd=camel-osgi.xsd,
http://camel.apache.org/schema/spring/camel-spring-2.0-M1.xsd=camel-spring.xsd,
http://camel.apache.org/schema/osgi/camel-osgi-2.4.0.xsd=camel-osgi.xsd,
http://camel.apache.org/schema/osgi/camel-osgi-2.1.0.xsd=camel-osgi.xsd,
http://camel.apache.org/schema/spring=camel-spring.xsd,
http://camel.apache.org/schema/osgi/camel-osgi-2.3.0.xsd=camel-osgi.xsd,
http://camel.apache.org/schema/osgi/camel-osgi-2.0.0.xsd=camel-osgi.xsd,
http://camel.apache.org/schema/os
gi/camel-osgi-2.5.0.xsd=camel-osgi.xsd,
http://camel.apache.org/schema/osgi/camel-osgi-2.0-M3.xsd=camel-osgi.xsd,
http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.0.xsd,
http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd,
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd,
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd,
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd,
http://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd,
http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd,
http://www.springframework.org/schema/util/spring-ut
il-3.0.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd,
http://www.springframework.org/schema/lang/spring-lang-3.0.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd,
http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd,
http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd,
http://camel.apache.org/schema/osgi/camel-osgi-2.0-M2.xsd=camel-osgi.xsd,
http://camel.apache.org/schema/spring/v2.5=camel-spring-v2.5.xsd,
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd}
[ main] PluggableSchemaResolver DEBUG Found XML
schema [http://www.springframework.org/schema/beans/spring-beans-3.0.xsd] in
classpath: org/springframework/beans/factory/xml/spring-beans-3.0.xsd
[ main] PluggableSchemaResolver DEBUG Found XML
schema [http://www.springframework.org/schema/util/spring-util-3.0.xsd] in
classpath: org/springframework/beans/factory/xml/spring-util-3.0.xsd
[ main] PluggableSchemaResolver DEBUG Found XML
schema [http://www.springframework.org/schema/tool/spring-tool-3.0.xsd] in
classpath: org/springframework/beans/factory/xml/spring-tool-3.0.xsd
[ main] PluggableSchemaResolver DEBUG Found XML
schema [http://camel.apache.org/schema/spring/camel-spring.xsd] in classpath:
camel-spring.xsd
[ main] ltBeanDefinitionDocumentReader DEBUG Loading
bean definitions
[ main] efaultNamespaceHandlerResolver DEBUG Loaded
NamespaceHandler mappings:
{http://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler,
http://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler,
http://camel.apache.org/schema/spring/v2.5=org.apache.camel.spring.handler.CamelNamespaceHandler,
http://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler,
http://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler,
http://camel.apache.org/schema/osgi=org.apache.camel.osgi.CamelNamespaceHandler,
http://www.springframework.org/schema/tx=org.springframework.transaction.config.TxNamespaceHandler,
http://camel.apache.org/schema/spring=org.apache.camel.spring.handler.CamelNamespaceHandler,
http://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler,
http://
www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler,
http://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler}
[ main] BeanDefinitionParserDelegate DEBUG Neither
XML 'id' nor 'name' specified - using generated bean name
[org.ektorp.spring.HttpClientFactoryBean#48a77106]
[ main] CamelNamespaceHandler INFO OSGi
environment not detected.
[ main] CamelNamespaceHandler DEBUG Using
org.apache.camel.spring.CamelContextFactoryBean as
CamelContextBeanDefinitionParser
[ main] CamelNamespaceHandler DEBUG
Registered default: org.apache.camel.spring.CamelProducerTemplateFactoryBean
with id: template on camel context: camel-1
[ main] CamelNamespaceHandler DEBUG
Registered default: org.apache.camel.spring.CamelConsumerTemplateFactoryBean
with id: consumerTemplate on camel context: camel-1
[ main] XmlBeanDefinitionReader DEBUG Loaded 6
bean definitions from location pattern [META-INF/spring/*.xml]
[ main] ClassPathXmlApplicationContext DEBUG Bean
factory for
org.springframework.context.support.classpathxmlapplicationcont...@4a79717e:
org.springframework.beans.factory.support.defaultlistablebeanfact...@3dbe8711:
defining beans
[couchdbProperties,couchDbConnector,template,consumerTemplate,camel-1:beanPostProcessor,camel-1];
root of factory hierarchy
[ main] DefaultListableBeanFactory DEBUG Creating
shared instance of singleton bean 'camel-1:beanPostProcessor'
[ main] DefaultListableBeanFactory DEBUG Creating
instance of bean 'camel-1:beanPostProcessor'
[ main] DefaultListableBeanFactory DEBUG Eagerly
caching bean 'camel-1:beanPostProcessor' to allow for resolving potential
circular references
[ main] DefaultListableBeanFactory DEBUG Finished
creating instance of bean 'camel-1:beanPostProcessor'
[ main] ClassPathXmlApplicationContext DEBUG Unable to
locate MessageSource with name 'messageSource': using default
[org.springframework.context.support.delegatingmessagesou...@3488b1e6]
[ main] ClassPathXmlApplicationContext DEBUG Unable to
locate ApplicationEventMulticaster with name 'applicationEventMulticaster':
using default
[org.springframework.context.event.simpleapplicationeventmulticas...@2598c6f3]
[ main] DefaultListableBeanFactory INFO
Pre-instantiating singletons in
org.springframework.beans.factory.support.defaultlistablebeanfact...@3dbe8711:
defining beans
[couchdbProperties,couchDbConnector,template,consumerTemplate,camel-1:beanPostProcessor,camel-1];
root of factory hierarchy
[ main] DefaultListableBeanFactory DEBUG Creating
shared instance of singleton bean 'couchdbProperties'
[ main] DefaultListableBeanFactory DEBUG Creating
instance of bean 'couchdbProperties'
[ main] DefaultListableBeanFactory DEBUG Eagerly
caching bean 'couchdbProperties' to allow for resolving potential circular
references
[ main] DefaultListableBeanFactory DEBUG Creating
shared instance of singleton bean 'camel-1'
[ main] DefaultListableBeanFactory DEBUG Creating
instance of bean 'camel-1'
[ main] DefaultListableBeanFactory DEBUG Eagerly
caching bean 'camel-1' to allow for resolving potential circular references
[ main] DefaultListableBeanFactory DEBUG Returning
cached instance of singleton bean 'camel-1:beanPostProcessor'
[ main] DefaultListableBeanFactory DEBUG Returning
eagerly cached instance of singleton bean 'camel-1' that is not fully
initialized yet - a consequence of a circular reference
[ main] SpringCamelContext DEBUG Set the
application context classloader to: sun.misc.launcher$appclassloa...@6d6f0472
[ main] DefaultListableBeanFactory DEBUG Invoking
afterPropertiesSet() on bean with name 'camel-1'
[ main] DefaultListableBeanFactory DEBUG Returning
eagerly cached instance of singleton bean 'couchdbProperties' that is not fully
initialized yet - a consequence of a circular reference
[ main] DefaultTypeConverter DEBUG Loading
type converters ...
[ main] AnnotationTypeConverterLoader INFO Loading
file META-INF/services/org/apache/camel/TypeConverter to retrieve list of
packages, from url:
jar:file:/Users/varnerac/.m2/repository/org/apache/camel/camel-core/2.5.0/camel-core-2.5.0.jar!/META-INF/services/org/apache/camel/TypeConverter
[ main] AnnotationTypeConverterLoader INFO Loading
file META-INF/services/org/apache/camel/TypeConverter to retrieve list of
packages, from url:
jar:file:/Users/varnerac/.m2/repository/org/apache/camel/camel-mail/2.5.0/camel-mail-2.5.0.jar!/META-INF/services/org/apache/camel/TypeConverter
[ main] efaultPackageScanClassResolver DEBUG Searching
for annotations of org.apache.camel.Converter in packages:
[org.apache.camel.component.file, org.apache.camel.component.bean,
org.apache.camel.converter, org.apache.camel.component.mail]
[ main] efaultPackageScanClassResolver DEBUG Found:
[class org.apache.camel.component.file.GenericFileConverter, class
org.apache.camel.component.bean.BeanConverter, class
org.apache.camel.converter.CamelConverter, class
org.apache.camel.converter.CollectionConverter, class
org.apache.camel.converter.IOConverter, class
org.apache.camel.converter.NIOConverter, class
org.apache.camel.converter.ObjectConverter, class
org.apache.camel.converter.TimePatternConverter, class
org.apache.camel.converter.jaxp.DomConverter, class
org.apache.camel.converter.jaxp.StaxConverter, class
org.apache.camel.converter.jaxp.StreamSourceConverter, class
org.apache.camel.converter.jaxp.XmlConverter, class
org.apache.camel.converter.stream.StreamCacheConverter, class
org.apache.camel.component.mail.MailConverters]
[ main] AnnotationTypeConverterLoader INFO Found 4
packages with 14 @Converter classes to load
[ main] AnnotationTypeConverterLoader DEBUG Loading
converter class: org.apache.camel.component.file.GenericFileConverter
[ main] AnnotationTypeConverterLoader DEBUG Loading
converter class: org.apache.camel.component.bean.BeanConverter
[ main] AnnotationTypeConverterLoader DEBUG Loading
converter class: org.apache.camel.converter.CamelConverter
[ main] AnnotationTypeConverterLoader DEBUG Loading
converters class: org.apache.camel.converter.CollectionConverter
[ main] AnnotationTypeConverterLoader DEBUG Loading
converter class: org.apache.camel.converter.IOConverter
[ main] AnnotationTypeConverterLoader DEBUG Loading
converter class: org.apache.camel.converter.NIOConverter
[ main] AnnotationTypeConverterLoader DEBUG Loading
converter class: org.apache.camel.converter.ObjectConverter
[ main] AnnotationTypeConverterLoader DEBUG Loading
converter class: org.apache.camel.converter.TimePatternConverter
[ main] AnnotationTypeConverterLoader DEBUG Loading
converter class: org.apache.camel.converter.jaxp.DomConverter
[ main] AnnotationTypeConverterLoader DEBUG Loading
converter class: org.apache.camel.converter.jaxp.StaxConverter
[ main] AnnotationTypeConverterLoader DEBUG Loading
converter class: org.apache.camel.converter.jaxp.StreamSourceConverter
[ main] AnnotationTypeConverterLoader DEBUG Loading
converter class: org.apache.camel.converter.jaxp.XmlConverter
[ main] AnnotationTypeConverterLoader DEBUG Loading
converter class: org.apache.camel.converter.stream.StreamCacheConverter
[ main] AnnotationTypeConverterLoader DEBUG Loading
converter class: org.apache.camel.component.mail.MailConverters
[ main] DefaultTypeConverter DEBUG Loading
type converters done
[ main] DefaultTypeConverter INFO Loaded
150 type converters in 0.697 seconds
[ main] bstractCamelContextFactoryBean DEBUG Found
JAXB created routes: []
[ main] efaultPackageScanClassResolver DEBUG Searching
for implementations of org.apache.camel.RoutesBuilder in packages:
[com.ninefx.customs.routes]
[ main] efaultPackageScanClassResolver DEBUG Found:
[class com.ninefx.customs.routes.IncomingEmailCustomsRequestRouteBuilder]
[ main] DefaultListableBeanFactory DEBUG Creating
instance of bean
'com.ninefx.customs.routes.IncomingEmailCustomsRequestRouteBuilder'
[ main] DefaultListableBeanFactory DEBUG Finished
creating instance of bean
'com.ninefx.customs.routes.IncomingEmailCustomsRequestRouteBuilder'
[ main] PackageScanRouteBuilderFinder DEBUG Adding
instantiated RouteBuilder: Routes: []
[ main] DefaultCamelContext DEBUG Adding
routes from builder: Routes: []
[ main] DefaultListableBeanFactory DEBUG Finished
creating instance of bean 'camel-1'
[ main] DefaultListableBeanFactory DEBUG Invoking
afterPropertiesSet() on bean with name 'couchdbProperties'
[ main] PropertiesFactoryBean INFO Loading
properties file from class path resource [couchdb.properties]
[ main] DefaultListableBeanFactory DEBUG Finished
creating instance of bean 'couchdbProperties'
[ main] DefaultListableBeanFactory DEBUG Creating
shared instance of singleton bean 'couchDbConnector'
[ main] DefaultListableBeanFactory DEBUG Creating
instance of bean 'couchDbConnector'
[ main] DefaultListableBeanFactory DEBUG Creating
instance of bean 'couchDbInstance'
[ main] DefaultListableBeanFactory DEBUG Creating
instance of bean 'org.ektorp.spring.HttpClientFactoryBean#48a77106'
[ main] DefaultListableBeanFactory DEBUG Finished
creating instance of bean 'org.ektorp.spring.HttpClientFactoryBean#48a77106'
[ main] HttpClientFactoryBean DEBUG host: null
[ main] HttpClientFactoryBean DEBUG port: 0
[ main] HttpClientFactoryBean DEBUG
maxConnections: 0
[ main] HttpClientFactoryBean DEBUG
connectionTimeout: 1000
[ main] HttpClientFactoryBean DEBUG
socketTimeout: 10000
[ main] DefaultListableBeanFactory INFO
Destroying singletons in
org.springframework.beans.factory.support.defaultlistablebeanfact...@3dbe8711:
defining beans
[couchdbProperties,couchDbConnector,template,consumerTemplate,camel-1:beanPostProcessor,camel-1];
root of factory hierarchy
[ main] DisposableBeanAdapter DEBUG Invoking
destroy() on bean with name 'camel-1'
[ main] DefaultCamelContext INFO Apache
Camel 2.5.0 (CamelContext:camel-1) is shutting down
[ main] DefaultCamelContext INFO JMX
enabled. Using ManagedManagementStrategy.
[ main] DefaultShutdownStrategy INFO Starting
to graceful shutdown 0 routes (timeout 300 seconds)
[ main] DefaultExecutorServiceStrategy DEBUG Created new
single thread pool for source:
org.apache.camel.impl.defaultshutdownstrat...@57f7cdc7 with name: ShutdownTask.
-> java.util.concurrent.executors$finalizabledelegatedexecutorserv...@4de6f0ef
[ Camel Thread 0 - ShutdownTask] DefaultShutdownStrategy DEBUG There are
0 routes to shutdown
[ main] DefaultShutdownStrategy INFO Graceful
shutdown of 0 routes completed in 0 seconds
[ main] DefaultCamelContext INFO Uptime:
not started
[ main] DefaultCamelContext INFO Apache
Camel 2.5.0 (CamelContext: camel-1) is shutdown in 0.110 seconds
[ main] MainSupport INFO Apache
Camel 2.5.0 stopping
Exception in thread "main"
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'couchDbConnector' defined in file
[/Users/varnerac/Documents/workspace/customs-processor/target/classes/META-INF/spring/camel-context.xml]:
Cannot create inner bean 'couchDbInstance' of type [org.ektorp.impl.StdCouchDbInstance]
while setting constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'couchDbInstance' defined in file
[/Users/varnerac/Documents/workspace/customs-processor/target/classes/META-INF/spring/camel-context.xml]:
Cannot create inner bean 'org.ektorp.spring.HttpClientFactoryBean#48a77106' of type
[org.ektorp.spring.HttpClientFactoryBean] while setting constructor argument; nested
exception is org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.ektorp.spring.HttpClientFactoryBean#48a77106': FactoryBean threw exception
on object cre
ation; nested exception is java.lang.IllegalArgumentException: Host name may
not be null
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
at
org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:630)
at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
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
org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:219)
at org.apache.camel.spring.Main.doStart(Main.java:173)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
at org.apache.camel.impl.MainSupport.run(MainSupport.java:114)
at org.apache.camel.impl.MainSupport.run(MainSupport.java:291)
at org.apache.camel.spring.Main.main(Main.java:97)
at
com.ninefx.customs.routes.IncomingEmailCustomsRequestRouteBuilder.main(IncomingEmailCustomsRequestRouteBuilder.java:21)
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'couchDbInstance' defined in file
[/Users/varnerac/Documents/workspace/customs-processor/target/classes/META-INF/spring/camel-context.xml]:
Cannot create inner bean 'org.ektorp.spring.HttpClientFactoryBean#48a77106' of
type [org.ektorp.spring.HttpClientFactoryBean] while setting constructor
argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.ektorp.spring.HttpClientFactoryBean#48a77106': FactoryBean threw
exception on object creation; nested exception is
java.lang.IllegalArgumentException: Host name may not be null
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
at
org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:630)
at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)
... 24 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'org.ektorp.spring.HttpClientFactoryBean#48a77106':
FactoryBean threw exception on object creation; nested exception is
java.lang.IllegalArgumentException: Host name may not be null
at
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
at
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:274)
... 32 more
Caused by: java.lang.IllegalArgumentException: Host name may not be null
at org.apache.http.HttpHost.<init>(HttpHost.java:83)
at
org.ektorp.http.StdHttpClient$Builder.configureClient(StdHttpClient.java:147)
at org.ektorp.http.StdHttpClient$Builder.build(StdHttpClient.java:199)
at
org.ektorp.spring.HttpClientFactoryBean.getObject(HttpClientFactoryBean.java:39)
at
org.ektorp.spring.HttpClientFactoryBean.getObject(HttpClientFactoryBean.java:19)
at
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
... 34 more
[ Thread-1] Main$HangupInterceptor INFO Received
hang up - stopping the main instance.
--end snip--
Here's what I think has happened:
The HttpClientFactoryBean is not using the information from couchdb.properties
correctly through Builder.:
[ main] HttpClientFactoryBean DEBUG host: null
[ main] HttpClientFactoryBean DEBUG port: 0
[ main] HttpClientFactoryBean DEBUG
maxConnections: 0
[ main] HttpClientFactoryBean DEBUG
connectionTimeout: 1000
[ main] HttpClientFactoryBean DEBUG
socketTimeout: 10000
Spring is reading the coucdhb.properties file from the classpath:
[ main] PropertiesFactoryBean INFO Loading
properties file from class path resource [couchdb.properties]
Is there any Camel magic in the Spring context that would interfere with my
ability to use util:properties correctly? Similar configurations in the Ektorp
examples work in vanilla Spring contexts.
Thanks,
Drew
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang