Hi,

I will first check the code in order to be able to run it in Camel with
quickfix/j (it seems that there is a classloading issue inside quickfix/j,
...) and deploy it in OSGI server.
After, I will check why there is an issue with the XML file, ....

Regards

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com


On Wed, May 6, 2009 at 6:51 AM, Willem Jiang <[email protected]> wrote:

> Yes, declare the component in the spring configuration file just a walk
> around solution.
>
> I can dig the code of quickfix resource loading later today.
>
> Willem
>
> Claus Ibsen wrote:
> > On Tue, May 5, 2009 at 5:15 PM, Charles Moulliard <[email protected]>
> wrote:
> >> 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 ?
> > No but its your job to dig into the code base :)
> >
> > I assume the code that reads the resources from the URI has a flaw.
> > I can help with this later. The important part is to make sure the
> > camel-quickfix component works, has the features we want and is
> > properly tested etc.
> >
> > Then later we can fix the minor issues with resource loading.
> > It should support loading in classpath, file, and OSGi :)
> >
> >
> >
> >
> >>
> >> 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
> >>>>>
> >>>>
> >
> >
> >
>
>

Reply via email to