users@jaxb.java.net

ClassCastException on jaxbcontext.newInstance()

From: moraleslos <moraleslos_at_hotmail.com>
Date: Wed, 7 Mar 2007 14:21:29 -0800 (PST)

I'm getting a weird CCE when I invoke the newInstance() on JAXBContext. The
invocation is done in the constructor of my service class and looks like
this:
----------------------
jaxbContext = JAXBContext.newInstance(XmlRootClass.class);
---------------------


Below is the error I'm getting:
----------------------------------
Caused by: java.lang.ClassCastException:
com.sun.xml.internal.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$5 cannot
be cast to com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl
        at
com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl.getBaseClass(ClassInfoImpl.java:170)
        at
com.sun.xml.internal.bind.v2.model.impl.RuntimeClassInfoImpl.getBaseClass(RuntimeClassInfoImpl.java:59)
        at
com.sun.xml.internal.bind.v2.model.impl.RuntimeClassInfoImpl.getBaseClass(RuntimeClassInfoImpl.java:39)
        at
com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:142)
        at
com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:48)
        at
com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:40)
        at
com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
        at
com.sun.xml.internal.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:56)
        at
com.sun.xml.internal.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:33)
        at
com.sun.xml.internal.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:22)
        at
com.sun.xml.internal.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:15)
        at
com.sun.xml.internal.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:38)
        at
com.sun.xml.internal.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:36)
        at java.util.AbstractList$Itr.next(AbstractList.java:345)
        at
com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:139)
        at
com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:48)
        at
com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:40)
        at
com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
        at
com.sun.xml.internal.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:56)
        at
com.sun.xml.internal.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:33)
        at
com.sun.xml.internal.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:22)
        at
com.sun.xml.internal.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:15)
        at
com.sun.xml.internal.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:38)
        at
com.sun.xml.internal.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:36)
        at java.util.AbstractList$Itr.next(AbstractList.java:345)
        at
com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:139)
        at
com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:48)
        at
com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:40)
        at
com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
        at
com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:204)
        at
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:356)
        at
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:217)
        at
com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
        at
com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:381)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
        at com.test.music.BookDataConverter.<init>(BookDataConverter.java:53)
------------------------------------------------------

Any ideas? Thanks in advance!

-los
-- 
View this message in context: http://www.nabble.com/ClassCastException-on-jaxbcontext.newInstance%28%29-tf3365426.html#a9363633
Sent from the java.net - jaxb users mailing list archive at Nabble.com.