3110https://www.ibm.com/developerworks/community/forums/atom/replies?topicUuid=77777777-0000-0000-0000-000014779429Check the JAXB context factory initialization class Replies2013-07-30T15:25:53.325ZIBM Connections - Discussion Forumurn:lsid:ibm.com:forum:0063b0bd-194a-4a72-a892-164c41076b49Re: Check the JAXB context factory initialization class2013-07-30T15:25:53.325Zc.high060001STAHactive2013-07-30T15:25:53.325Z
<p dir="ltr">
It is best practices to use the WebSphere supported version of JAXB, and you will want to use the default initialization class for best performance.&nbsp;
</p>
<p dir="ltr">
If your application is dependent on the behavior of the particular JAXB implementation you are currently shipping, you can continue to use it, but make sure your classloader is set to parentlast so that your implementation gets loaded before the WebSphere version.
</p>
<p dir="ltr">
&nbsp;
</p>
<p dir="ltr">
Cindy
</p>
none, view_forum, view_categoryurn:lsid:ibm.com:forum:f9684a02-83ad-4c5e-a9f8-aced6f45ff1cRe: Check the JAXB context factory initialization class2013-07-30T07:08:15.029Zsp30270006GYX4active2013-07-30T07:08:15.029Z
<p dir="ltr">
That was useful, in the application I am upgrading
</p>
<p dir="ltr">
Currently the application code on (java 1.5 run on WAS6.1) references external jaxb 2.x jars. (api and impl jars).
</p>
<p dir="ltr">
There is no properties file as mentioned above, instead the javax.xml.bind.context.factory = com.sun.xml.bind.ContextFactory is mentioned in the
</p>
<p dir="ltr">
external JAXBContext class mentioned in the external jaxb-api&nbsp; jar.
</p>
<p dir="ltr">
On researching , what I understood is WAS8.0 comes bundled with its on version of JAXB.(rt.jar)<br />
What is the right thing to do? Remove the reference to the external jars and use the jaxb jar that comes bundled with<br />
WAS8.0 or leave the code as it is and compile and checkin the code.<br />
&nbsp;
</p>
none, view_forum, view_categoryurn:lsid:ibm.com:forum:77777777-0000-0000-0000-000014779597Re: Check the JAXB context factory initialization class2012-01-18T15:07:37.702ZSystemAdmin110000D4XKactive2012-01-18T15:07:37.702Z
Please see the help associated with the rule. To access the help select the rule and press F1, or shift-F1 on linux.<br />
<br />
The help for the rule in question states:<br />
"This rule flags the JAXBContext newInstance() method because the context factory method had changed since earlier versions of JAXB. Scan properties files to see if an old context factory is being used."<br />
<br />
Furthermore, the detailed help states:<br />
<br />
The WebSphere 6.1 Feature pack for Web services shipped JAXB 2.0 which used a different initialization class than is used in JAXB 2.1 or 2.2. <br />
The initialization class can be defined using the javax.xml.bind.context.factory property. The old initialization class was com.sun.xml.bind.ContextFactory. If the old class name is set on the javax.xml.bind.context.factory property, you will get a java.lang.ClassNotFoundException when using the JAXB libraries available with Java 6. <br />
This rule scans for the javax.xml.bind.JAXBContext.newInstance method which is used to obtain a JAXBContext. If you are using JAXB, you should check your application for use of the old context factory. The rule will also detect the string literals "com.sun.xml.bind.ContextFactory" or "com.sun.xml.bind.DefaultJAXBContextImpl" in Java code, but it does not scan property files where these values are often set. <br />
JAXB properties are commonly loaded from a jaxb.properties file. Manually scan your application property files to determine if the old context factory is defined. <br />
To scan the the properties files in Eclipse, select Search &gt; File.... In the Containing text field, type com.sun.xml.bind.ContextFactory. In the File name patterns field, type *.properties. Repeat the search for the string com.sun.xml.bind.DefaultJAXBContextImpl. <br />
When using JAXB in WebSphere V7 or V8, the default initialization class is com.ibm.xml.xlxp2.jaxb.JAXBContextFactory if no javax.xml.bind.context.factory property is set. You can also use the Java provided context factory com.sun.xml.internal.bind.v2.ContextFactory.
none, view_forum, view_category