Our problem is in wildfly-camel but the root cause of the problem is likely to be in Camel. My application contains two rest services in two route builders as well as some support classes. Some of the support classes are Jacson annotated pojos used as part of the API. Some potentially relevant camel components are camel-cdi, camel-jackson and camel-swagger-java. Some of the rest routes produces rest responses and contains bindingmode, produces and outType elements. The routebuilders are annotated with @ApplicationScoped, @ContextName and @Startup. All of the classes are contained in the same war file. When starting the war inside Wildfly 14 everything works fine. The problem starts when packing the WAR file in an EAR with other related applications then trying to starting the EAR. The routes fails during startup due to classloader issues. The problem being that the route builders can't find my Jacson annotated interface pojos, the routebulders contained in the same war is found. I suspect that the reason is that the Jackson objectmapper used is started using a different classloader, but can't find a clean way of ensuring that jackson here uses the same classloader as the routebuilder. Our current workaround is to deploy the war separately but we would like to avoid this. Any help soving the problem will be appreciated either by pointing me in the right direction regarding camel-jackson or by fixing the underlying routebuilder problem.
