users@jaxb.java.net

Re: error "Type mismatch: cannot convert from XmlAccessType to AccessType"

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Wed, 9 Dec 2009 13:05:56 +0100

On Wed, Dec 9, 2009 at 12:32 PM, maven apache <apachemaven0_at_gmail.com>wrote:

>
>
> 2009/12/9 Wolfgang Laun <wolfgang.laun_at_gmail.com>
>
>> You are running JAXB runtime bundled with JDK 6 against JAva sources
>> compiled with
>> a much older JAXB's schema compiler xjc.
>>
>
> Sorry ,because I am not familiar with jaxb( I used to work with
> xmlbeans..), so do you mean my jdk version should be lower?
> Because this is a third-part project, I do not have the schema. So I do not
> know which xjc they use.
> In fact , not matter I use 1.5 or 1.6 ,the problem exists still.
>

This is revealing because JDK 1.5 came without JAXB support. This means that
somewhere you have
very old jaxb runtime jars containing the obsolete annotation class
AccessType.

Stick with JDK 1.6.

I suggest you locate all jars (wherever they might be, referred to from
Eclipse) and run
   jar -tf jaxb-api.jar | grep AccessType
If this doesn't show
   javax/xml/bind/annotation/XmlAccessType.class
but
   javax/xml/bind/annotation/AccessType.class
then throw it (and all others near it!) away.


>
>
>> PPS: Screenshots are nice, but the important info is hidden, i.e., the
>> comment header
>> of the generated Java source.
>>
>> The header is here: http://imagebin.org/74721
>

Ugh, the timestamp is from June 2005, which is a liability. You'll just have
to hope that
the code generated then doesn't contain any snags. Alert the "third party"
to the
pending risk.

If you don't have the schema (which is the usual way of communicating an XML
interface,
NOT the Java classes that were generated in some setup), you should try and
get it, or else
hope that it hasn't changed since.

Cheers
-W