• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Type mismatch: cannot convert from AccessType to XmlAccessType

 
Himanhsu Yadav
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing the same problem again. Any resolution?
 
ntumba lobo
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Himanhsu Yadav
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This did'nt work for me. I am still getting the same error.
 
ntumba lobo
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21113
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic