users@jaxb.java.net

Re: JAXB 1.0.1 Sealing Violation

From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
Date: Tue, 13 Dec 2005 13:22:58 -0800

Kohsuke Kawaguchi wrote:
> Prashant wrote:
>> Hi Koshuke,
>>
>>>>> JAXB RI ver.X can run applications that are developed with JAXB RI
>>>>> ver.Y as long as X>Y. So you can put jaxb-impl.jar from JAXB 1.0.4,
>>>>> throw away all JAXB 1.0.1 jars, and it should work.
>>>>
>>>>
>>>> I had tried that too. I copied all the 4 jaxb jars from 1.0.4
>>>> distribution (jaxb-apis, jaxb-impl, jaxb-libs, and jaxb-xjc) to
>>>> replace those 4 jars from 1.0.1 version.
>>>
>>>
>>> Mmm, this is really supposed to work.
>>>
>>> The error you saw will happen only if
>>> com/sun/ts/lib/porting/web/jaxb.properties is missing
>>> "com.sun.xml.bind.jaxbContextImpl" property, but this should have been
>>> there since 1.0.1 --- can you send us your jaxb.properties?
>>
>>
>> Yes, your guess is correct. the jaxb.properties at the specified package
>> does not specify the property "com.sun.xml.bind.jaxbContextImpl".
>>
>> $ cat com/sun/ts/lib/porting/web/jaxb.properties
>> #Sun Nov 16 20:50:32 EST 2003
>> javax.xml.bind.context.factory=com.sun.xml.bind.ContextFactory_1_0_1
>
> I'm checking relevant CVS history to find out when this was introduced.
> I must have been wrong in saying this property has been there since 1.0.
>
> Will get back to you later...

I checked the source code of JAXB RI 1.0 FCS and 1.0.1, and confirmed
that com.sun.xml.bind.jaxbContextImpl property is really there since
1.0.1, which makes me wonder if your original code is really generated
from 1.0.1.

However, in 1.0 FCS, the jaxb.properties would look like:

   javax.xml.bind.context.factory=com.sun.xml.bind.ContextFactory

So it can't be from 1.0 FCS. Besides, if the jaxb.properties really just
contains the following line alone (without the jaxbContextimpl property):

   javax.xml.bind.context.factory=com.sun.xml.bind.ContextFactory_1_0_1

then there's no way it would have worked in the first place, as
ContextFactory_1_0_1 class is supposed to report an error for the lack
of the jaxbContextImpl property, since 1.0.1.

I'm really confused.

The only possible explanation to me is that the code is generated by
some early access or some such snapshot build of 1.0.1. If you look at
the generated Java code, it should have a build number of JAXB RI baked
in it as a comment. Can you check that?


In terms of working around this problem, adding:

com.sun.xml.bind.jaxbContextImpl=com.sun.ts.lib.porting.web.impl.runtime.DefaultJAXBContextImpl

should really fix the problem. Looking at the code, the only reason you
can get "The specified package "com.sun.ts.lib.porting.web" is
incompatible with the current JAXB runtime." error is because this
property is missing. (But then you said you added it, which makes me
doubly-confused --- I can only ask you to check it again carefully.)

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com