aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Type mismatch: cannot convert from AccessType to XmlAccessType Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Type mismatch: cannot convert from AccessType to XmlAccessType" Watch "Type mismatch: cannot convert from AccessType to XmlAccessType" New topic
Author

Type mismatch: cannot convert from AccessType to XmlAccessType

Himanhsu Yadav
Ranch Hand

Joined: Sep 26, 2007
Posts: 33
I am using WebLogic Workshop9.2 with JDK 1.5. My code is running fine on it. When I tried to run it on Weblogic 10 with JDK 1.6, I am getting following compile time error "Type mismatch: cannot convert from AccessType to XmlAccessType". I have to run with latest JAXB jars but not able to resolve it.
Please help.
Himanhsu Yadav
Ranch Hand

Joined: Sep 26, 2007
Posts: 33
I am facing the same problem again. Any resolution?
ntumba lobo
Ranch Hand

Joined: Oct 21, 2008
Posts: 180
That's because weblogic 9.2 and weblogic 10 have different server classpath.
Chances are that weblogic 10 has a different version of the JAXB jar in its classpath (that it uses by default) but it is not the version expected by your application.

So if you have JAXB jar in your web-inf/lib you need to tell weblogic to use your version of JAXB instead of his.
You do that by adding under WEB-INF the file weblogic.xml with the following content

<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>

I hope that'll help


SCJP 5 , SCWCD 5, SCEA 5
Himanhsu Yadav
Ranch Hand

Joined: Sep 26, 2007
Posts: 33
This did'nt work for me. I am still getting the same error.
ntumba lobo
Ranch Hand

Joined: Oct 21, 2008
Posts: 180
Hum I remember now that the jdk1.6 has a bigger api than jdk1.5 and it comes with a default impleementation for JAXB.
Maybe at runtime the JAXB from the jdk which is used and it's the version expected by your app.
There is mechanism to override the apis provided by default in the jdk.
http://download.oracle.com/javase/1.5.0/docs/guide/standards/index.html

so if you have a different version of JAXB you want to use on your file system just tell the jdk to use your version
instead of its default impl.

try to give that a go
Himanhsu Yadav
Ranch Hand

Joined: Sep 26, 2007
Posts: 33
Then how to resolve it? Should I creata a endorsed dit in <java-home>\lib\endorsed location and place all the JAXB jars from <project dir>/WEB-INF/lib to endorsed folder?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18657
    
    8

Step 1: Forget about WebLogic for now, write a small Java application which you can run under Java 6, and have it do the process you're now doing in WebLogic. Make sure it only uses the Java 6 version of JAXB and doesn't use any of the pre-Java-6 JAXB jars.

Step 2: When you have that working, implement the changes you had to make into the code which will run in WebLogic. Deploy that code into WebLogic, without any of the pre-Java-6 JAXB jars.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Type mismatch: cannot convert from AccessType to XmlAccessType