Author |
Message
|
4integration |
Posted: Mon Nov 24, 2008 1:07 pm Post subject: JAXB support in WMB 6.1 |
|
|
 Disciple
Joined: 04 Sep 2006 Posts: 197 Location: Gothenburg, Sweden
|
Hello,
I am trying to get JAXB to work in WMB 6.1 but have some problem.
If I rely on the JVM in WMB 6.1 I get
Code: |
java.lang.NoClassDefFoundError: javax.xml.bind.JAXBException |
so I tried to add the JARs "jaxb-api-2.1.ar" and "jaxb-impl-2.1.5.jar" and now get
Code: |
Provider com.sun.xml.bind.v2.ContextFactory not found |
I have searched WMB installation package and could find the JAXB API and impl in <install_root>\IBM\MQSI\6.1\webservices but it seems not to find it.
How should I approach this to use JAXB in WMB 6.1 ? _________________ Best regards
4 Integration |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Nov 24, 2008 3:47 pm Post subject: Re: JAXB support in WMB 6.1 |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
4integration wrote: |
Hello,
I am trying to get JAXB to work in WMB 6.1 but have some problem.
If I rely on the JVM in WMB 6.1 I get
Code: |
java.lang.NoClassDefFoundError: javax.xml.bind.JAXBException |
so I tried to add the JARs "jaxb-api-2.1.ar" and "jaxb-impl-2.1.5.jar" and now get
Code: |
Provider com.sun.xml.bind.v2.ContextFactory not found |
I have searched WMB installation package and could find the JAXB API and impl in <install_root>\IBM\MQSI\6.1\webservices but it seems not to find it.
How should I approach this to use JAXB in WMB 6.1 ? |
What are you trying to do with JAXB that the broker can't do out of the box for you?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
4integration |
Posted: Tue Nov 25, 2008 1:54 am Post subject: |
|
|
 Disciple
Joined: 04 Sep 2006 Posts: 197 Location: Gothenburg, Sweden
|
Hello,
We have some configurations in XML files on the file system that we are loading via JAXB.
Those XML's are business rules how the messages will be routed etc and it will later be in a database but due to limited time we are using XML. _________________ Best regards
4 Integration |
|
Back to top |
|
 |
JLRowe |
Posted: Tue Nov 25, 2008 5:24 am Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
You can either upgrade your JRE to java 1.6 which has JAXB built-in, or go to the JAXB website and download the jars you need and use with java 5.
The built-in version of JAXB lags behind the latest releases, but you can override the JRE JAXB through the JRE extension mechanism.
I don't understand why you think IBM would ship the JAXB jars in the message broker product directory? (unless of course they ship java 6, but jaxb is built-in to the JRE jars in that case) |
|
Back to top |
|
 |
4integration |
Posted: Tue Nov 25, 2008 5:28 am Post subject: |
|
|
 Disciple
Joined: 04 Sep 2006 Posts: 197 Location: Gothenburg, Sweden
|
I think it's a classloader issue but have not yet found the solution..... _________________ Best regards
4 Integration |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 25, 2008 6:38 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I don't think that Broker 6.1 is supported for JRE 1.6 - but I haven't looked lately.
I don't think using JAXB in Message Broker is a good idea. Read the contents of the files, pass it to the XMLNSC parser, use normal Broker methods to access the data.
There are some classloader peculiarities in 6.1.0.2 that I've been hearing about.
You can try adding
Code: |
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); |
to your JCN and see if that helps. |
|
Back to top |
|
 |
4integration |
Posted: Tue Nov 25, 2008 11:50 am Post subject: |
|
|
 Disciple
Joined: 04 Sep 2006 Posts: 197 Location: Gothenburg, Sweden
|
I have the XML as String in a JCN, how can I utilize XMLNSC parser to get it parsed this way (programatic).
I know how when using MQInputNode etc to get the message parsed by WMB but not as this.. _________________ Best regards
4 Integration |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 25, 2008 1:40 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
4integration |
Posted: Wed Nov 26, 2008 1:29 am Post subject: |
|
|
 Disciple
Joined: 04 Sep 2006 Posts: 197 Location: Gothenburg, Sweden
|
Hello,
The JAXB related error was connected to the classloader and the solution was to use:
Code: |
JAXBContext jaxbContext = JAXBContext.newInstance(MyClass.class.getPackage().getName(), MyClass.class.getClassLoader()); |
instead of
Code: |
JAXBContext jaxbContext = JAXBContext.newInstance(MyClass.class.getPackage().getName()); |
Seems to work just fine
Reference: https://jaxb.dev.java.net/faq/jaxb10faq.html#classloader _________________ Best regards
4 Integration |
|
Back to top |
|
 |
|