0

I'm running a Camel application on Liberty Profile server. I'm taking a message from a queue, unmarshalling, mapping then marshalling. This was working fine but now I'm getting an error that JAXBDataBinding method getContextualNamespaceMap is not found. I think this is because there is an older version of the jar in the server libs but I don't know why it started using it.

IBM Jar: com.ibm.ws.org.apache.cxf-rt-databinding-jaxb.2.6.2_1.0.12

The issue is resolved if I switch to parent last class loading but its a very hacky way to fix it and is not a great option. Any other ideas? I'm thinking some feature or other dependency in my build may have pulled this jar in.

kinsey
  • 65
  • 7
  • What features are you using and what JRE? – Scott Kurz Apr 21 '16 at 22:05
  • javaee-7.0 dependencies { compile 'org.apache.camel:camel-core:2.16.2' compile 'org.apache.camel:camel-jms:2.16.2' compile 'org.apache.camel:camel-jaxb:2.16.2' compile 'org.apache.camel:camel-dozer:2.16.2' compile 'org.apache.camel:camel-cxf:2.16.2' compile 'javax.xml:jaxrpc:1.1' compile 'org.apache.activemq:activemq-core:5.7.0' compile 'com.sun.xml.bind:jaxb-xjc:2.2.11' compile 'org.springframework:spring-web:4.2.4.RELEASE' compile 'log4j:log4j:1.2.17' compile 'org.slf4j:slf4j-log4j12:1.6.6' } – kinsey Apr 22 '16 at 07:17
  • //test dependencies testCompile 'org.apache.camel:camel-test-spring:2.16.2' testCompile 'junit:junit:4.8.1' testCompile 'xmlunit:xmlunit:1.3' – kinsey Apr 22 '16 at 07:18

2 Answers2

0

So it does look like getContextualNamespaceMap is only available in newer versions of the org.apache.cxf-rt-databinding-jaxb JAR than what is available in Liberty.

It might be that parentLast is the best option then. (You already know how to do this but it's documented (here). If it leads to some other issues then do follow-up with another question.

I suppose it's conceivable you might be able to look at whatever is packaged within your application and try removing a set of things and picking them up from the Liberty runtime, to avoid running in parentLast mode. E.g. if you are only referencing getContextualNamespaceMap because you have other code in your app but there is some alternative path you could have gone down entirely in the Liberty-provided modules, then in theory you could be OK.

I'm not familiar enough with the code paths in the modules in the CXF or Camel "stack" to guess whether that's a real-world likelihood though.

Scott Kurz
  • 4,985
  • 1
  • 18
  • 40
  • I must be using some JAR in the IBM libs that is referencing the databinding JAR right? I believe it would use the app version otherwise. So if I could figure out what JAR that is and add it to my application JARs could that resolve the issue? – kinsey Apr 22 '16 at 12:36
  • I've confirmed that its the Camel-CXF dependency that causes the problem. I can marshal no problem if I remove the CXF endpoint, but I need that to call out to a web service. – kinsey Apr 22 '16 at 12:55
  • Maybe my answer was confusing: I was suggesting you were probably right to use the *parentLast* option to get the newer databinding JAR in your application rather than the older version in Liberty. But then I said, "well, it's possible you might not NEED to if *parentLast* causes some other issue". But if so then we're on to a more complicated problem that I wouldn't venture to comment on. Make sense? – Scott Kurz Apr 22 '16 at 13:14
  • Sorry - got that, but we're hoping to avoid having to do that. I think the CXF dependency coming in must be looking for a JAR and not finding it, so resorting to using a server JAR which uses the databinding JAR off the server. – kinsey Apr 22 '16 at 13:26
0

The javaee7 feature contained a jaxsw version that clashed with the server version. Removing the javaee7 feature has resolved this issue. Remains to be seen whether or not I will to add it back in.

kinsey
  • 65
  • 7