[GLASSFISH-19287] JAXB 1.0 based applications do not work due to JAXB-899 Created: 05/Nov/12  Updated: 17/Jan/13  Resolved: 17/Jan/13

Status: Resolved
Project: glassfish
Component/s: web_services
Affects Version/s: 3.1.2.2
Fix Version/s: None

Type: Bug Priority: Blocker
Reporter: bthalmayr Assignee: Iaroslav Savytskyi
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Tags: jaxb, metro-gf3125

 Description   

Having a web-application which uses classes created by JAXB 1.0.x does not run on GF 3.1.2.2 due to bug JAXB-899

Copying stacktrace from JAXB-899

Caused by: javax.xml.bind.JAXBException

  • with linked exception:
    [java.lang.NoSuchFieldError: theInstance]
    at com.sun.xml.bind.ContextFactory_1_0_1.createContext(ContextFactory_1_0_1.java:100)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
    at javax.xml.bind.ContextFinder.find(Unknown Source)
    at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
    at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
    at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
    at mypackage.JAXBContextWrapper.getInstance(JAXBContextWrapper.java:57)
    at mypackage.JAXBObjectWrapper.getUnmarshallerStatic(JAXBObjectWrapper.java:161)
    at mypackage.JAXBObjectWrapper.unmarshalStatic(JAXBObjectWrapper.java:184)
    at mypackage.JAXBObjectWrapper.<init>(JAXBObjectWrapper.java:67)
    ... 11 more
    Caused by: java.lang.NoSuchFieldError: theInstance
    at mypackage.generated.jaxb104.impl.runtime.DefaultJAXBContextImpl.<init>(DefaultJAXBContextImpl.java:50)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.sun.xml.bind.ContextFactory_1_0_1.createContext(ContextFactory_1_0_1.java:94)
    ... 24 more


 Comments   
Comment by kumara [ 05/Nov/12 ]

-> web_services because glassfish gets jaxb from metro integration handled through web_services sub component.

Comment by Martin Grebac [ 05/Nov/12 ]

Yarda, please work with Lukas on getting this fixed in a branch for GF 3.1.2.x patch. Thanks.

Comment by bthalmayr [ 05/Nov/12 ]

We try to deliver a JAXB 1.0 based web-application (as we do not have time to migrate it to JAXB 2.0).

As this web-app can be run on fully J2EE compliant container like GF v3 and servlet engines like Tomcat we possibly need to deliver 2 different distro of the application

Old discussion: 'self-contained' vs. 'container-provided' libraries

As JAXB 2.0 should be backward compatible (for all my readings) we actually don't want to bundle any J2EE related libraries with the 'J2EE distro'.

Comment by Martin Grebac [ 07/Nov/12 ]

Yardo, as we're defining jaxb-extra-osgi since metro 2.1.1 for backw. compatibility purposes, I think that would be the right place for jaxb1 as well - what do you think?

Comment by Iaroslav Savytskyi [ 07/Nov/12 ]

Definitely you are right. May be it's also a good idea to mark jaxb-extra-osgi as 'optional' jar.

Comment by Iaroslav Savytskyi [ 21/Nov/12 ]

Hi, all,

as I understand GF 3.1.2.2 uses JAXB 2.2.5.2 which contains JAXB1 classes. So probably problem is somewhere else. We need testcase to reproduce this bug.

Comment by Martin Grebac [ 21/Nov/12 ]

Hi, went again through this more properly - the fix for this went into 2.2.6:

Revision: 3918
Author: snajper
Date: 2012-05-11 15:20:09 UTC
Log Message:
------------
fix for JAXB-899 - keep the jaxb1 required methods, but deprecate all of them + the class -> issue 723 will remain closed because we removed usage of these duplications from the RI2 code and deprecation should (hopefully) make sure we don't start using them again
the whole class should be refactored away eventually in the future - requires little api update since currently it's impossible to reuse the API DTC instead of the RI's one

The bug is not about missing class (thus it is not osgi issue), but about missing theInstance method which was caused as a regression from trying to merge the DTC implementations used in jaxb api/ri. So, I guess the only thing needed is to merge the fix into 2.2.5.x codebase.

Comment by Iaroslav Savytskyi [ 20/Dec/12 ]

Hi,

I've merged 3918 revision to jaxb 2.2.5.3 version.

Comment by Iaroslav Savytskyi [ 17/Jan/13 ]

Should be integrated into 3.1.2.5 GF version.
JAXB SVN revision: 3997

Generated at Thu Feb 11 08:02:00 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.