I am facing the following issues when using the camel routing in
servicemix. The deployment is done as osgi bundle. The version is
fuse-esb-4.1.0.1
I'm making webservice call , get the response and write to a file
system. It works fine when I define the cxf bean in java as
from(source).to(Constants.MATH_URI).to(result);
where MATH_URI = cxf://" + MATH_ADDRESS + "?serviceClass=" +
MATH_SERVICE_CLASS;
However, when I define the cxf as spring component in my
camelcontext.xml and refer to it, I get the following two issues ( My
DSL now is
from(source).to("cxf:bean:mathServiceEndpoint").to(result);
1. When I update the bundle and start, I get the following error. (To
work around, I have to exit the servicemix and start all over !)
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'mathServiceEndpoint': Initialization of bean failed;
nested exception is java.lang.IllegalStateException: BeanFactory not
initialized or already closed - call 'refresh' before accessing beans
via the ApplicationContext
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.createBean(AbstractAutowireCapableBeanFactory.java:380)
...
2. When I put in the request to call the web service and camel does the
web service call, it throws the error
java.lang.RuntimeException: Could not find conduit initiator for
transport http://schemas.xmlsoap.org/soap/http
<http://schemas.xmlsoap.org/soap/http>
at
org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTranspor
tFactory.java:148)
at
org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(Abstr
actConduitSelector.java:79)
at
org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSel
ector.java:61)
at
org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.jav
a:688)
at
org.apache.camel.component.cxf.invoker.CxfClient.invokeWithMessageStream
(CxfClient.java:128)
at
org.apache.camel.component.cxf.invoker.CxfClient.dispatch(CxfClient.java
:76)
at
org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:236)
at
org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:156)
at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToA
syncProcessorBridge.process(AsyncProcessorTypeConverter.java:43)
at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:84)
at
org.apache.camel.management.InstrumentationProcessor.process(Instrumenta
tionProcessor.java:68)
at
org.apache.camel.processor.interceptor.StreamCachingInterceptor.proceed(
StreamCachingInterceptor.java:87)
at
org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(
StreamCachingInterceptor.java:82)
at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.j
ava:189)
at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.j
ava:133)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:115)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:89)
...
The camelcontext.xml is
<beans xmlns="http://www.springframework.org/schema/beans
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://www.springframework.org/schema/beans> "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://www.w3.org/2001/XMLSchema-instance> "
xmlns:ctx="http://www.springframework.org/schema/context
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://www.springframework.org/schema/context> "
xmlns:osgi="http://activemq.apache.org/camel/schema/osgi
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://activemq.apache.org/camel/schema/osgi> "
xmlns:cxf="http://activemq.apache.org/camel/schema/cxfEndpoint
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://activemq.apache.org/camel/schema/cxfEndpoint> "
xsi:schemaLocation="
http://www.springframework.org/schema/beans
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://www.springframework.org/schema/beans>
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd>
http://www.springframework.org/schema/context
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://www.springframework.org/schema/context>
http://www.springframework.org/schema/context/spring-context.xsd
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://www.springframework.org/schema/context/spring-context.xsd>
http://activemq.apache.org/camel/schema/cxfEndpoint
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://activemq.apache.org/camel/schema/cxfEndpoint>
http://activemq.apache.org/camel/schema/cxf/camel-cxf-1.6.0.xsd
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://activemq.apache.org/camel/schema/cxf/camel-cxf-1.6.0.xsd>
http://activemq.apache.org/camel/schema/spring
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://activemq.apache.org/camel/schema/spring>
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd>
http://activemq.apache.org/camel/schema/osgi
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://activemq.apache.org/camel/schema/osgi>
http://activemq.apache.org/camel/schema/osgi/camel-osgi.xsd
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://activemq.apache.org/camel/schema/osgi/camel-osgi.xsd> ">
<osgi:camelContext
xmlns="http://activemq.apache.org/camel/schema/spring
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://activemq.apache.org/camel/schema/spring> ">
<!-- install the Java DSL route builder -->
<package>gov.ma.us.itd.router</package>
</osgi:camelContext>
<cxf:cxfEndpoint id="mathServiceEndpoint"
address="http://mydomain/itdtest/mathservicenocr
<wlmailhtml:{DC928111-2167-4B24-9D6A-554BDE0EB3E3}mid://00000002/!x-usc:
http://mydomain/itdtest/mathservicenocr> "
serviceClass="org.tempuri.Math">
</cxf:cxfEndpoint>
</beans>
Note:
To make the osgi bundle I use the maven-bundle-plugin. The entry in pom
is
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Import-Package>*,org.apache.camel.osgi</Import-Package>
<Private-Package>mypackage.*,org.tempuri.*</Private-Package>
</instructions>
</configuration>
</plugin>
Please note that the same code with the camelcontext.xml works fine
when I am using the camel router directly without the servericemix (i.e
using the fuse-mediation-router).
What am I missing ?
Thanks,
Reju