File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with xjc ant task in jdk 1.6 in weblogic 10.3

 
Jyothsna Panchagnula
Ranch Hand
Posts: 113
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have an xml and xsd files.

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


am I missing anything here?

thanks,
Jyothsna
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jyothsna Panchagnula
Ranch Hand
Posts: 113
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bala,

I am using now XJC compiler only from jdk1.6.

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.

am I missing anything here?


Thanks,
Jyothsna
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are probably using an old method to try marshalling or unmarshalling. This tutorial on the new version should help

 
Jyothsna Panchagnula
Ranch Hand
Posts: 113
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Deepak,

I am using the latest version only.

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).

thanks,
Jyothsna
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it is possible, you can post your XSD here and I can give it a try when time allows.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic