[ https://issues.apache.org/jira/browse/CAMEL-3438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972739#action_12972739 ]
xuhongbo commented on CAMEL-3438: --------------------------------- Hi: Could the DataFormatter interface add a initialize method? it need's no arguments. just plain init () method; if so, we could prepare the jaxb context at initializing time, but not at executing time(because at executing time to create jaxb context , will be unexpected) If camel doesn't accept , it's unfortunally. this means I cannot using jaxb databinding in osgi safely. etc: if I using a global OSGI ThreadPoolExecutor service to serve as the threadpool for camel components, then jaxb convert will failed; (because threads of ThreadPoolExecutor is not always created in the correct bundles); if you check the mail-list in the community, you will find such bug is reported by the other user, not only mine; you can find it by the topic (" Help with Camel JAXB (SMX4 + Camel 2.1.0)"). the mail is sent very earlier; The original mail illustrate two route, one route start by file component, jaxb will work right; while another route started by "direct" endpoint, it will failed. I think the reason is file component's thread is created in the spring context loading time, so it inherit the spring extender thread's context class loader. while the direct endpoint's belong to another user created thread, it's context class loader is not correct, so jaxb will failed; > JAXBDataFormatter should using Spring ApplicationContext's classLoader > explicitly > --------------------------------------------------------------------------------- > > Key: CAMEL-3438 > URL: https://issues.apache.org/jira/browse/CAMEL-3438 > Project: Camel > Issue Type: Bug > Affects Versions: 2.4.0 > Reporter: xuhongbo > Attachments: JaxbDataFormat.java > > > JAXBDataFormatter now using JAXBContext.newInstance(path) to create > JAXBContext, > but this will using Thread's context classLoader. > this may causing un-expected class or resource not found exceptions; -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.