Uploaded image for project: 'Mule'
  1. Mule
  2. MULE-5926

Autotransformer cannot handle situation where two or more JaxbContexts are defined

    Details

    • User impact:
      High
    • Configuration:
      Hide

      <mulexml:jaxb-context name="firstJaxb" packageNames="org.example.first" />
      <mulexml:jaxb-context name="secondJaxb" packageNames="org.example.second" />

      <http:outbound-endpoint address="$

      {example.http.restService}

      " exchange-pattern="request-response" />

      <auto-transformer returnClass="org.example.first.classToTransformTo" />

      Show
      <mulexml:jaxb-context name="firstJaxb" packageNames="org.example.first" /> <mulexml:jaxb-context name="secondJaxb" packageNames="org.example.second" /> <http:outbound-endpoint address="$ {example.http.restService} " exchange-pattern="request-response" /> <auto-transformer returnClass="org.example.first.classToTransformTo" />
    • Log Output:
      Hide
      ********************************************************************************
      Message : More than one object of type class javax.xml.bind.JAXBContext registered but only one expected.
      Type : org.mule.api.registry.RegistrationException
      Code : MULE_ERROR--2
      JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/registry/RegistrationException.html
      ********************************************************************************
      Exception stack is:
      1. More than one object of type class javax.xml.bind.JAXBContext registered but only one expected. (org.mule.api.registry.RegistrationException)
        org.mule.registry.AbstractRegistry:168 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/registry/RegistrationException.html)
      ********************************************************************************
      Root Exception stack trace:
      org.mule.api.registry.RegistrationException: More than one object of type class javax.xml.bind.JAXBContext registered but only one expected.
      at org.mule.registry.AbstractRegistry.lookupObject(AbstractRegistry.java:168)
      at org.mule.registry.AbstractRegistryBroker.lookupObject(AbstractRegistryBroker.java:134)
      at org.mule.registry.MuleRegistryHelper.lookupObject(MuleRegistryHelper.java:671)
      at org.mule.config.transformer.AbstractAnnotatedTransformerArgumentResolver.resolve(AbstractAnnotatedTransformerArgumentResolver.java:76)
      at org.mule.module.xml.transformer.jaxb.JAXBTransformerResolver.resolve(JAXBTransformerResolver.java:76)
      at org.mule.registry.MuleRegistryHelper.resolveTransformer(MuleRegistryHelper.java:265)
      at org.mule.registry.MuleRegistryHelper.lookupTransformer(MuleRegistryHelper.java:235)
      at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:346)
      at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:304)
      at org.mule.transformer.simple.AutoTransformer.transformMessage(AutoTransformer.java:47)
      at org.mule.transformer.AbstractMessageTransformer.transform(AbstractMessageTransformer.java:145)
      at org.mule.transformer.AbstractMessageTransformer.transform(AbstractMessageTransformer.java:93)
      at org.mule.DefaultMuleMessage.applyAllTransformers(DefaultMuleMessage.java:1387)
      at org.mule.DefaultMuleMessage.applyTransformers(DefaultMuleMessage.java:1348)
      at org.mule.DefaultMuleMessage.applyTransformers(DefaultMuleMessage.java:1340)
      at org.mule.transformer.AbstractTransformer.process(AbstractTransformer.java:119)
      at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:44)
      at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:44)
      at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:90)
      at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
      at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:44)
      at org.mule.construct.AbstractPipeline$1.process(AbstractPipeline.java:138)
      at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:195)
      at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:163)
      at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:150)
      at org.mule.transport.http.HttpMessageReceiver$HttpWorker.doRequest(HttpMessageReceiver.java:299)
      at org.mule.transport.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:258)
      at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:163)
      at org.mule.work.WorkerContext.run(WorkerContext.java:310)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

      ********************************************************************************
      Show
      ******************************************************************************** Message : More than one object of type class javax.xml.bind.JAXBContext registered but only one expected. Type : org.mule.api.registry.RegistrationException Code : MULE_ERROR--2 JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/registry/RegistrationException.html ******************************************************************************** Exception stack is: 1. More than one object of type class javax.xml.bind.JAXBContext registered but only one expected. (org.mule.api.registry.RegistrationException)   org.mule.registry.AbstractRegistry:168 ( http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/registry/RegistrationException.html ) ******************************************************************************** Root Exception stack trace: org.mule.api.registry.RegistrationException: More than one object of type class javax.xml.bind.JAXBContext registered but only one expected. at org.mule.registry.AbstractRegistry.lookupObject(AbstractRegistry.java:168) at org.mule.registry.AbstractRegistryBroker.lookupObject(AbstractRegistryBroker.java:134) at org.mule.registry.MuleRegistryHelper.lookupObject(MuleRegistryHelper.java:671) at org.mule.config.transformer.AbstractAnnotatedTransformerArgumentResolver.resolve(AbstractAnnotatedTransformerArgumentResolver.java:76) at org.mule.module.xml.transformer.jaxb.JAXBTransformerResolver.resolve(JAXBTransformerResolver.java:76) at org.mule.registry.MuleRegistryHelper.resolveTransformer(MuleRegistryHelper.java:265) at org.mule.registry.MuleRegistryHelper.lookupTransformer(MuleRegistryHelper.java:235) at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:346) at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:304) at org.mule.transformer.simple.AutoTransformer.transformMessage(AutoTransformer.java:47) at org.mule.transformer.AbstractMessageTransformer.transform(AbstractMessageTransformer.java:145) at org.mule.transformer.AbstractMessageTransformer.transform(AbstractMessageTransformer.java:93) at org.mule.DefaultMuleMessage.applyAllTransformers(DefaultMuleMessage.java:1387) at org.mule.DefaultMuleMessage.applyTransformers(DefaultMuleMessage.java:1348) at org.mule.DefaultMuleMessage.applyTransformers(DefaultMuleMessage.java:1340) at org.mule.transformer.AbstractTransformer.process(AbstractTransformer.java:119) at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:44) at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:44) at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:90) at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55) at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:44) at org.mule.construct.AbstractPipeline$1.process(AbstractPipeline.java:138) at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:195) at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:163) at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:150) at org.mule.transport.http.HttpMessageReceiver$HttpWorker.doRequest(HttpMessageReceiver.java:299) at org.mule.transport.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:258) at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:163) at org.mule.work.WorkerContext.run(WorkerContext.java:310) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) ********************************************************************************
    • Similar Issues:

      Description

      If you define two or more JaxbContexts in mule xml config and try to use autotransformer to unmarshall the xml to java object, the transformation fails. There's also no way to tell the auto-transformer to what jaxbContext to use.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              hequ Henri Kinnunen
            • Votes:
              6 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: