How about some complete code? Can you create a zip with your schema(s), the way you're running XJC and your main program?
----- Original Message ----
From: moraleslos <moraleslos@hotmail.com>
To: users@jaxb.dev.java.net
Sent: Thursday, March 8, 2007 9:34:57 AM
Subject: Re: [2] ClassCastException on jaxbcontext.newInstance()
Actually, I take that back. When I renamed my Detail class to JAXB2Detail
and ran a simple test, I still get the same error. So I'm back to square 1.
Any additional help would be appreciated. Thanks in advanced!
-los
moraleslos wrote:
>
> ok, i think i know what the problem is. One of my jaxb-fied objects is
> named Detail.java. There happens to be an interface of the same name in
> jdk 6. maybe when Jaxb2 is trying to create the context, it is confused
> and using the JDK's version instead of mine, producing this CCE. Is this
> possible? If so, is there a way to discriminate or namespace this in
> jaxb2 (using annotations)? Thanks in advance!
>
> -los
>
>
>
> moraleslos wrote:
>>
>> In my simple main method produces the same error... any other ideas? I'm
>> not sure how to go about debugging this.
>>
>> -los
>>
>>
>> Dmitri Colebatch-2 wrote:
>>>
>>> What's your environment? Can you reproduce this in a simple main
>>> method?
>>>
>>> My guess would be that its something to do with classloaders - if you
>>> have a class Foo loaded by one classloader, and then try to cast it to
>>> Foo loaded by a different classloader, you will get a CCE....
>>>
>>> cheers
>>> dim
>>>
>>> On 3/8/07, moraleslos <moraleslos@hotmail.com> wrote:
>>>>
>>>> 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.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@jaxb.dev.java.net
>>>> For additional commands, e-mail: users-help@jaxb.dev.java.net
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@jaxb.dev.java.net
>>> For additional commands, e-mail: users-help@jaxb.dev.java.net
>>>
>>>
>>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/ClassCastException-on-jaxbcontext.newInstance%28%29-tf3365426.html#a9374257
Sent from the java.net - jaxb users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@jaxb.dev.java.net
For additional commands, e-mail: users-help@jaxb.dev.java.net
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265