javaee / jaxb-spec

Formerly jsr222.java.net
Other
9 stars 16 forks source link

JAXBContext.newInstance(..., Classloader) does not work correctly in OSGi env #46

Closed glassfishrobot closed 10 years ago

glassfishrobot commented 11 years ago

Custom classloader is not used for lookup unless it is Thread.currentThread().getContextClassloader(). I don't see any reason for this check.

See JERSEY-1818 for more context.

Related to JAXB API 2.2.7

workaround: set context ClassLoader to something you want to use before JAXBContext.newInstance(...) call.

glassfishrobot commented 11 years ago

Reported by @pavelbucek

glassfishrobot commented 11 years ago

snajper said: Reason for the check is (AFAIR) suggestion from Sahoo to mitigate OSGi classloading issues where you can have classes loaded by multiple classloaders and that will cause weird hard to debug issues.

But I think the real issue here is that there's only one method for loading - not differentiating if the classloader has been passed to newInstance call or not. This should be fixed - in case classloader has been passed we should use only the passed classloader for loading, nothing else. I would discourage this to be fixed within 4.0 though - this will have consequences and we need to understand them properly before delivering the fix.

glassfishrobot commented 11 years ago

Issue-Links: is related to JERSEY-1818

glassfishrobot commented 11 years ago

Was assigned to yaroska

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JSR222-46

glassfishrobot commented 10 years ago

Marked as fixed on Monday, October 13th 2014, 8:04:02 am