[jboss-jira] [JBoss JIRA] Created: (JBAS-8417) Issue with loading JAXB library in JBOSS 4.3.0 with JDK6
Pek Lee Seow (JIRA)
jira-events at lists.jboss.org
Wed Sep 15 16:31:28 EDT 2010
Issue with loading JAXB library in JBOSS 4.3.0 with JDK6
--------------------------------------------------------
Key: JBAS-8417
URL: https://jira.jboss.org/browse/JBAS-8417
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: ClassLoading
Affects Versions: JBossAS-4.2.1.GA
Environment: I am currently running JBoss 4.3.0 CP06 which I understand is essentially 4.2.1.
Reporter: Pek Lee Seow
Assignee: Scott M Stark
Priority: Critical
I am having ClassCastException when instantiating JAXBContext within my web application.
javax.xml.bind.JAXBException: ClassCastException: attempting to cast jar:file:/C:/Documentum/jboss4.3.0/server/DctmServer_MethodServer/deploy/dfs.ear/APP-INF/lib/jaxb-api.jar!/javax/xml/bind/JAXBContext.class to jar:file:/C:/Documentum/jboss4.3.0/jdk/jre/lib/rt.jar!/javax/xml/bind/JAXBContext.class. Please make sure that you are specifying the proper ClassLoader.
javax.xml.bind.ContextFinder.handleClassCastException(ContextFinder.java:96)
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:205)
javax.xml.bind.ContextFinder.find(ContextFinder.java:363)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
HelloWorldServlet.marshallCode(HelloWorldServlet.java:62)
HelloWorldServlet.doGet(HelloWorldServlet.java:43)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
Here is the line of code where the problem occurs:
JAXBContext dataContext = JAXBContext.newInstance(MySimpleSouceData.class);
Basically my web application (WAR) is deployed as part of an .EAR file with jaxb-api.jar and jaxb-impl.jar included in the .ear's APP-INF/lib. The web application does not have any of the JAXB libraries included in the .war file.
The jboss-app.xml has been set to as follows:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-app>
<loader-repository>
com.emc.documentum.fs:loader=emc-dfs.ear
<loader-repository-config>
java2ParentDelegation=false
</loader-repository-config>
</loader-repository>
<library-directory>
APP-INF/lib
</library-directory>
</jboss-app>
I do not understand why the JAXBContext class instance from rt.jar (loaded by bootstrap/system classloader) is reference here when the configuration explicitly state to use the web application instance first (i.e. java2ParentDelegation=false).
When I remove the jboss-app.xml file, the ClassCastException goes away. It seems the JAXBContext class is loaded by:
org.jboss.mx.loading.UnifiedClassLoader3 at 2a2cc{ url=file:/C:/Documentum/jboss4.3.0/server/DctmServer_MethodServer/deploy/jbossws.sar/ ,addedOrder=12}
Is this a JBoss classloading bug?
What actually happens when jboss-app.xml is not provided? What is the default behaviour? And how is it that ClassCastException does not happen here??
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list