This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am trying to generate java classes using xjc ant task in jdk 1.6.
xsd file :
xml file :
When I generated java classes using the initial version of ie 1.0 of Jaxb , I saw that GuiField and GuifieldType classes were generated.
but when I was migrating the application from weblogic 8.1 sp6 to weblogic 10.3 only one class was generated ie GuiField.
I am not knowing whats going wrong , as some classes were looking for GuiField type and it is not genereted.
In jdk 1.5 I used the following jars for jaxb ie jaxb-api.jar , jaxb-impl.jar , jaxp-api.jar , jaxb-lib.jar.
with JDK 1.6 I used that jars that come with bea weblogic.
ie glassfish.jaxb.xjc_2.1.6.jar ,glassfish.jaxb_2.1.6.jar
Why would you need weblogic specific classes to generated the jaxb java files ? xjc as a standalone should be sufficient for jdk 6.
Which files are generated is dependent upon the XJC compiler. Internal representation types such as the GUIType java class should not have an impact on your code unless you wrote code that directly depended on that type.
But in one of the java files my code is referring to the method newInstance(java.lang.Class) , which was
generated by jaxb1.0 in ObjectFactory class.
ie the method new Instance(java.lang.class) was available with jaxb1.0 version.
But with jaxb2.0 this method is no longer generated.
Can any one tell me what should be the replacement for the above line of code.
I went through the specification but I didnt find any information so far.
The Weblogic 10.3 comes with JAXB 2.1. The problem is the ObjectFactory.java created by the xjc task using JAXB 2.1 is different from the older ObjectFactory.java created using the JAXB1.3. The newInstance() method is missing in the newer version because of which the existing code that uses this method is facing problems.
I can see the problem with 2.1 version only as that newInstance() method is available even in JAXB 2.0.
The Final version of the JSR 222 ( Jaxb 2.1) Architecture Document says that the ObjectFactory has that method.
This can be shown in the following code snippet taken from the Architecture document.
But I dont get that method when I try to generate the java files from the XSD document.
Can any one tell me what is the replacement for newInstance method in ObjectFactory (if there).