users@jaxb.java.net

ClassCastException: ...jaxb.impl.runtime.DefaultJAXBContextImpl

From: Karr, David <david.karr_at_wamu.net>
Date: Thu, 21 Oct 2004 22:28:30 -0700

I'm using JAXB 1.0.1, with WebLogic 8.1SP3.

I have two EARs deployed to a domain. The first EAR has several ejb and
web modules. One of the web modules registers a set of mbeans. In the
other EAR, a servlet invokes a method on one of the mbeans, whose return
type is a JAXB-generated type. The method in the mbean tries to create
a JAXBContext to unmarshal a stream into a JAXB object hierarchy and
then returns the top-level object.

I've struggled through a handful of classloader-related issues in the
single call to create the JAXBContext. To get past the issues with
finding the jaxb.properties file and the ContextFactory_1_0_1 class, I
passed an instance of a simple custom ClassLoader to the
JAXBContext.newInstance() method, which just uses the current context
class loader to load the named entities.

My current error looks like this (the package hierarchy specific to my
project is elided):

java.lang.ClassCastException:
...jaxb.impl.runtime.DefaultJAXBContextImpl
        at
javax.xml.bind.JAXBContext.newInstance(Ljava.lang.String;Ljava.lang.Clas
sLoader;)Ljavax.xml.bind.JAXBContext;(JAXBContext.java:281)

I haven't been able to figure out why this is happening.

I noticed in the Sun bug database, bug #4860458 is titled
"ClassNotFoundException:
org.oasis.ubl.order.impl.runtime.DefaultJAXBContextImpl". It says the
bug was found in release 1.0.1, and it is fixed. It doesn't say which
release the bug is fixed in.

Does anyone know about this problem, or the bug report I refer to? It
would be useful to know what was found to be wrong, whether there is a
workaround in v1.0.1, and what release the bug was fixed in.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net