users@jaxb.java.net

Re: JAXB 1.0.1 Sealing Violation

From: Prashant <prashant_at_pramati.com>
Date: Wed, 14 Dec 2005 11:22:58 +0530

Hi Koshuke:

Please find my reply towards the end of this email.

>>> [Prashant] 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
>>
>>
>> [koshuke] 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...
>
>
> [koshuke] 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.)

Ok my bad, stupid me! The modified "jaxb.propeties" was not getting
picked up.

Now it looks like your assertion that replacing jaxb 1.0.1 jars with
jaxb 1.0.4 version ones must work is true except that i had to modify
the generated jaxb.properties file. Although i am not quite sure
modifying the jax.properties in third party source code is viable work
around, I could live with it.

In anycase since I am targeting my code to work in varied conditions, i
think trying to load JAXB classes from my own classloader would give me
a lot more control.

About looking up the JAXB RI version in Generated Java Code's javadoc :
I searched for strings "version" "build" but all i could find was

public static final String JAXB_RI_BUILD_ID = "jaxb.ri.build.id"; in
DefaultJAXBImpl class file but no number ?

Could you tell me what string i should be looking for and in which class ?

Thanks again,
-Prashant