Thank you Willem! I changed the TCCL before creating the camel context and restored it after the route was started - that did the trick.
Now, I wonder, is this really a good design? A properly designed OSGI enabled component shouldn't use the TCCL right? Isn't that one of the big problems when using Spring in OSGi? I would argue that Camel should not do any TCCL tricks in order to be a good citizen in the OSGi world - WDYT? Thanks again, /Bengt 2011/5/26 Willem Jiang <[email protected]> > camel-cxf endpoint will try to use the TCCL to load the class which you > specify from the URI with serviceClass option. > If you are using spring extender to load camel route, spring will set the > TCCL with the bundle class loader and it has no trouble to load the SEI. > As you are using iPOJO to inject the bundel context, I suggest you to set > the TCCL when you start up the camel context. > > Willem > > On 5/26/11 9:18 PM, Bengt Rodehav wrote: > >> Willem, >> >> Can you explain that a bit? Should I change the thread context classloader >> prior to creating the camel context? I don't quite understand. >> >> /Bengt >> >> 2011/5/26 Willem Jiang<[email protected]> >> >> Maybe you need to set the thread context classloader with the classloader >>> which loads the SEI class. >>> >>> >>> On 5/26/11 8:50 PM, Bengt Rodehav wrote: >>> >>> Willem, >>>> >>>> I don't "load" my camel context, I create it programmatically like this: >>>> >>>> * CamelContextFactory factory = new CamelContextFactory(); >>>> >>>> factory.setBundleContext(bc); >>>>> CamelContext context = factory.createContext();* >>>>> >>>>> >>>> >>>> I get the bundle context (bc) from iPOJO when my component is >>>> constructed. >>>> >>>> /Bengt >>>> >>>> 2011/5/26 Willem Jiang<[email protected]> >>>> >>>> Hi, >>>> >>>>> >>>>> I'm not sure how do you load the camel context. >>>>> camel-cxf bundle don't need to import your customer SEI package, you >>>>> just >>>>> need to make sure you thread context classloader can load the SEI >>>>> class. >>>>> >>>>> >>>>> On 5/26/11 7:19 PM, Bengt Rodehav wrote: >>>>> >>>>> Hello again Willem, >>>>> >>>>>> >>>>>> Yes the ITrsWebService class is actually part of the bundle that >>>>>> contains >>>>>> the route and its package is exported. When I use Spring with >>>>>> "cxf:bean", >>>>>> as >>>>>> I described earlier, Spring seems to have no problem finding this >>>>>> interface. >>>>>> >>>>>> However, I cannot see that the camel-cxf bundle is importing this >>>>>> package. >>>>>> Shouldn't it have a dynamic import of "*"? How else can camel-cxf load >>>>>> a >>>>>> class it isn't aware of? >>>>>> >>>>>> I've tried to do "update 165" (165 is the camel-cxf bundle) to make it >>>>>> resolve again and perhaps find my class - but it doesn't help. >>>>>> >>>>>> /Bengt >>>>>> >>>>>> 2011/5/26 Willem Jiang<[email protected]> >>>>>> >>>>>> On 5/26/11 6:16 PM, Bengt Rodehav wrote: >>>>>> >>>>>> >>>>>>> * ITrsWebService serverBean = new TrsWebServiceImpl(); >>>>>>> >>>>>>> >>>>>>>> > from("cxf: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> >>>>>>>>>> >>>>>>>>> http://localhost:9001/trsws/?serviceClass=se.digia.trs.route.webservice.ITrsWebService >>>>>>>>> >>>>>>>>> ").bean(serverBean);* >>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> But for some reason camel-cxf can't seem to find the >>>>>>>>> ITrsWebService >>>>>>>>> >>>>>>>> class >>>>>>>> (an interface). I get the following exception: >>>>>>>> >>>>>>>> >>>>>>>> Can you check if your application bundle can access the SEI class >>>>>>>> >>>>>>>> without >>>>>>> any issue ? >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Willem >>>>>>> ---------------------------------- >>>>>>> FuseSource >>>>>>> Web: http://www.fusesource.com >>>>>>> Blog: http://willemjiang.blogspot.com (English) >>>>>>> http://jnn.javaeye.com (Chinese) >>>>>>> Twitter: willemjiang >>>>>>> >>>>>>> Connect at CamelOne May 24-26 >>>>>>> The Open Source Integration Conference >>>>>>> http://camelone.com >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> -- >>>>> Willem >>>>> ---------------------------------- >>>>> FuseSource >>>>> Web: http://www.fusesource.com >>>>> Blog: http://willemjiang.blogspot.com (English) >>>>> http://jnn.javaeye.com (Chinese) >>>>> Twitter: willemjiang >>>>> >>>>> Connect at CamelOne May 24-26 >>>>> The Open Source Integration Conference >>>>> http://camelone.com >>>>> >>>>> >>>>> >>>> >>> -- >>> Willem >>> ---------------------------------- >>> FuseSource >>> Web: http://www.fusesource.com >>> Blog: http://willemjiang.blogspot.com (English) >>> http://jnn.javaeye.com (Chinese) >>> Twitter: willemjiang >>> >>> Connect at CamelOne May 24-26 >>> The Open Source Integration Conference >>> http://camelone.com >>> >>> >> > > -- > Willem > ---------------------------------- > FuseSource > Web: http://www.fusesource.com > Blog: http://willemjiang.blogspot.com (English) > http://jnn.javaeye.com (Chinese) > Twitter: willemjiang > > Connect at CamelOne May 24-26 > The Open Source Integration Conference > http://camelone.com >
