With the following config, it works :
<bean id="quickfix-server"
class="org.apache.camel.quickfix.QuickfixAcceptor"/>
<bean id="quickfix-client"
class="org.apache.camel.quickfix.QuickfixInitiator"/>
<camel:camelContext trace="true" xmlns="
http://camel.apache.org/schema/osgi">
<camel:route>
<camel:from uri="quickfix-server:META-INF/examples/server.cfg"/>
<camel:to uri="quickfix-client:META-INF/examples/client.cfg"/>
</camel:route>
</camel:camelContext>
Any idea why we have to declare the beans ?
Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer
*****************************
blog : http://cmoulliard.blogspot.com
On Tue, May 5, 2009 at 5:12 PM, Charles Moulliard <[email protected]>wrote:
> I have modified the spring xml file like you propose :
>
> <camel:camelContext trace="true" xmlns="
> http://camel.apache.org/schema/osgi">
> <camel:route>
> <camel:from uri="quickfix-server:examples/server.cfg"/>
> <camel:to uri="quickfix-client:examples/client.cfg"/>
> </camel:route>
> </camel:camelContext>
>
> and now we have the error :
>
> s...@root:osgi> Exception in thread "SpringOsgiExtenderThread-63"
> org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint:
> quickfix-server:examples/ser
> ver.cfg due to: java.io.FileNotFoundException: class path resource
> [examples/server.cfg] cannot be opened because it does not exist
>
> at
> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:378)
> at
> org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:52)
> at
> org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:133)
> at
> org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:103)
> at
> org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:109)
> at
> org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
> at
> org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:78)
> at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:302)
> at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:121)
> at
> org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:481)
> at
> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:777)
> at
> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:759)
> at
> org.apache.camel.spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:165)
> at
> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:160)
> at
> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:50)
> at
> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:95)
> at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:114)
> at
> org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
> at
> org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
> at
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
> at
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
> at
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
> at
> org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)
> at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)
> at
> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
> at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
> at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationC
> ontextExecutor.java:136)
> at java.lang.Thread.run(Thread.java:619)
> *Caused by: java.io.FileNotFoundException: class path resource
> [examples/server.cfg] cannot be opened because it does not exist*
> at
> org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:143)
> at
> org.apache.camel.quickfix.QuickfixEndpoint.start(QuickfixEndpoint.java:167)
> at
> org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:510)
> at
> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:372)
> ... 27 more
>
> I will change the path and retest
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>
>
> On Tue, May 5, 2009 at 5:08 PM, Willem Jiang <[email protected]>wrote:
>
>> Hi Charles,
>>
>> I just checked the code with the stack trace, and found this issue may
>> caused by the java.lang.NullPointerException.
>>
>> Here is the code snippet of the OsgiComponentResolver.
>> try {
>> type = getComponent(name);
>> } catch (Throwable e) {
>> throw new IllegalArgumentException("Invalid URI, no
>> Component registered for schema : " + name, e);
>> }
>>
>> The getComponent() method just search the bundle entry for the component.
>>
>> I have no idea why the NPE will be thrown from this getComponent() method.
>>
>> Willem
>>
>> Charles Moulliard wrote:
>> > Hi,
>> >
>> > I'm currently working on the new camel-quickfix component provided by
>> Anton
>> > Arhipov.
>> >
>> > I have created a camel spring xml file to use it :
>> >
>> > <camel:camelContext trace="true" xmlns="
>> > http://camel.apache.org/schema/osgi">
>> > <camel:route>
>> > <camel:from uri="quickfix-server:examples/server.cfg"/>
>> > <camel:to uri="quickfix-client:examples/client.cfg"/>
>> > </camel:route>
>> > </camel:camelContext>
>> >
>> > but when the component is launched, I receive the following error :
>> >
>> > 16:25:20,625 | ERROR | xtenderThread-53 | ContextLoaderListener
>> |
>> > BundleApplicationContextListener 50 | Application context refresh
>> failed
>> > (OsgiBundleXmlApplicationContext(bundle=reportincident.quickfix,
>> > config=osgibundle:/META-INF/spring/*.xml))
>> > org.apache.camel.ResolveEndpointFailedException: *Failed to resolve
>> > endpoint: quickfix-server:examples/server.cfg* due to:
>> > org.apache.camel.RuntimeCamelException: Could not auto create component:
>> > quickfix-server
>> > at
>> >
>> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:378)
>> > at
>> >
>> org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:52)
>> > at
>> >
>> org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:133)
>> > at
>> >
>> org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:103)
>> > at
>> >
>> org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:109)
>> > at
>> >
>> org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
>> > at
>> >
>> org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:78)
>> > at
>> >
>> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:302)
>> > at
>> >
>> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:121)
>> > at
>> >
>> org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:481)
>> > at
>> >
>> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:777)
>> > at
>> >
>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:759)
>> > at
>> >
>> org.apache.camel.spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:165)
>> > at
>> >
>> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:160)
>> > at
>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:50)
>> > at
>> >
>> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:95)
>> > at
>> >
>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:114)
>> > at
>> >
>> org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
>> > at
>> >
>> org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
>> > at
>> >
>> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
>> > at
>> >
>> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
>> > at
>> >
>> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
>> > at
>> >
>> org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)
>> > at
>> >
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)
>> > at
>> >
>> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
>> > at
>> >
>> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
>> > at
>> >
>> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)
>> > at java.lang.Thread.run(Thread.java:619)
>> > Caused by: org.apache.camel.RuntimeCamelException: Could not auto create
>> > component: quickfix-server
>> > at
>> >
>> org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:211)
>> > at
>> >
>> org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:354)
>> > ... 27 more
>> > Caused by: java.lang.IllegalArgumentException: *Invalid URI, no
>> Component
>> > registered for scheme : quickfix-server*
>> > at
>> >
>> org.apache.camel.osgi.OsgiComponentResolver.resolveComponent(OsgiComponentResolver.java:66)
>> > at
>> >
>> org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:201)
>> > ... 28 more
>> > Caused by: java.lang.NullPointerException
>> > When looking in the code provided, I see that Anton has created under
>> the
>> > directory META-INF/services, the following files :
>> >
>> > org\apache\camel\component\quickfix-server
>> >
>> > class=org.apache.camel.quickfix.QuickfixAcceptor
>> >
>> > org\apache\camel\component\quickfix-client
>> >
>> > class=org.apache.camel.quickfix.QuickfixInitiator
>> >
>> > Is it enough to register new camel endpoints ?
>> >
>> > Regards,
>> >
>> > Charles Moulliard
>> > Senior Enterprise Architect
>> > Apache Camel Committer
>> >
>> > *****************************
>> > blog : http://cmoulliard.blogspot.com
>> >
>>
>>
>