Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16040

JAXB error Generating Swagger in Karaf

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.7.0
    • 3.7.1, 3.8.0
    • camel-swagger-java
    • None
    • Karaf 4.2.10

      Windows

      Camel Rest Dsl (Java)

    • Patch Available
    • Unknown
    • Patch

    Description

      When generating a Swagger for the Rest Java DSL in Karaf with the camel-core-osgi bundle I'm receiving the following exception[1]

      It appears this is happening because the core/camel-xml-jaxb bundle does not import all the packages defined in the org.apache.camel.model.Constants.JAXB_CONTEXT_PACKAGES so it is unable to see the jaxb.index.

       

      I was able to get it to work by manually adding the packages to the camel.osgi.import property in the pom since the packages are not used anywhere else in the camel-xml-jaxb.  Doesn't seem like a great solution since it requires the pom to match the packages defined in Constants.JAXB_CONTEXT_PACKAGES.  Open to other suggestions.

       

      [1]

       

      2021-01-14T16:35:37,850 | WARN  | Camel (camel-2) thread #17 - NettyConsumerExecutorGroup | RestSwaggerProcessor             | 164 - org.apache.camel.camel-swagger-java - 3.7.0 |  | Error rendering Swagger API due "org.apache.camel.model.cloud" doesnt contain ObjectFactory.class or jaxb.index
      javax.xml.bind.JAXBException: "org.apache.camel.model.cloud" doesnt contain ObjectFactory.class or jaxb.index
      	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:260) ~[jaxb-runtime-2.3.3.jar:2.3.3]
      	at com.sun.xml.bind.v2.JAXBContextFactory.createContext(JAXBContextFactory.java:48) ~[jaxb-runtime-2.3.3.jar:2.3.3]
      	at javax.xml.bind.ContextFinder.find(ContextFinder.java:302) ~[?:?]
      	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:478) ~[?:?]
      	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:435) ~[?:?]
      	at org.apache.camel.xml.jaxb.DefaultModelJAXBContextFactory.newJAXBContext(DefaultModelJAXBContextFactory.java:39) ~[?:?]
      	at org.apache.camel.xml.jaxb.DefaultModelJAXBContextFactory.newJAXBContext(DefaultModelJAXBContextFactory.java:29) ~[?:?]
      	at org.apache.camel.xml.jaxb.JaxbModelToXMLDumper.getJAXBContext(JaxbModelToXMLDumper.java:195) ~[?:?]
      	at org.apache.camel.xml.jaxb.JaxbModelToXMLDumper.dumpModelAsXml(JaxbModelToXMLDumper.java:69) ~[?:?]
      	at org.apache.camel.swagger.RestSwaggerSupport.getRestDefinitions(RestSwaggerSupport.java:152) ~[!/:3.7.0]
      	at org.apache.camel.swagger.RestSwaggerSupport.renderResourceListing(RestSwaggerSupport.java:232) ~[!/:3.7.0]
      	at org.apache.camel.swagger.RestSwaggerProcessor.process(RestSwaggerProcessor.java:120) [!/:3.7.0]
      	at org.apache.camel.support.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:66) [!/:3.7.0]
      	at org.apache.camel.component.rest.RestApiProducer.process(RestApiProducer.java:39) [!/:3.7.0]
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:169) [!/:3.7.0]
      	at org.apache.camel.support.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:94) [!/:3.7.0]
      	at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:714) [!/:3.7.0]
      	at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:623) [!/:3.7.0]
      	at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148) [!/:3.7.0]
      	at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:60) [!/:3.7.0]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:147) [!/:3.7.0]
      	at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:312) [!/:3.7.0]
      	at org.apache.camel.component.netty.handlers.ServerChannelHandler.processAsynchronously(ServerChannelHandler.java:142) [!/:3.7.0]
      	at org.apache.camel.component.netty.handlers.ServerChannelHandler.channelRead0(ServerChannelHandler.java:113) [!/:3.7.0]
      	at org.apache.camel.component.netty.http.handlers.HttpServerChannelHandler.channelRead0(HttpServerChannelHandler.java:221) [!/:3.7.0]
      	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) [!/:4.1.55.Final]
      	at com.footlocker.api.core.FootlockerHttpServerMultiplexChannelHandler.channelRead0(FootlockerHttpServerMultiplexChannelHandler.java:265) [!/:?]
      	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) [!/:4.1.55.Final]
      	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [!/:4.1.55.Final]
      	at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:61) [!/:4.1.55.Final]
      	at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:370) [!/:4.1.55.Final]
      	at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66) [!/:4.1.55.Final]
      	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) [!/:4.1.55.Final]
      	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [!/:4.1.55.Final]
      	at java.lang.Thread.run(Thread.java:834) [?:?]
      

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bob Bob Paulin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: