users@jersey.java.net

Re: [Jersey] ClassCastException with JAXB / Date

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 03 Mar 2010 17:24:54 +0100

On Mar 3, 2010, at 5:18 PM, Robert Naczinski wrote:

> Hi Paul,
>
>
> I found this bevore wrote a message to user_at_jerse..... ;-(
>
> I use java.util.Date. I try java.sql.Timestamp but the exception is
> the same. Any idea?
>

No, since this is a JAXB specific issue you might get more help on the
GlassFish or JAXB user lists.

Paul.

> When I use java.util.Calendar, I get the same exception.
>
> Robert
>
>
> 2010/3/3 Paul Sandoz <Paul.Sandoz_at_sun.com>:
>> Hi Robert,
>>
>> The following may help:
>>
>> http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14208125&tstart=0
>>
>> The last post from the above states:
>>
>> Looks like this issue is caused by “Date” data type. JAXB is
>> trying to cast
>> it to java.util.Date when the business
>> object is of type java.sql.Date. After fixing this to
>> java.util.Date, it is
>> working.
>>
>> Paul.
>>
>> On Mar 3, 2010, at 2:39 PM, Robert Naczinski wrote:
>>
>>> Hi,
>>>
>>> I get a java.lang.ClassCastException:
>>> com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$5
>>> incompatible with com.sun.xml.bind.v2.model.impl.ClassInfoImpl
>>> when I
>>> use a java.sql.Timestamp or java.util.Date in my entity object.
>>>
>>> Knows somebody a Solution? I use jersey 1.1.5 and jaxb-api 2.1,
>>> jaxb.impl
>>> 2.1.10
>>>
>>> The StackTrace is:
>>>
>>> [03.03.10 12:44:45:997 CET] 0000001e WebApp E [Servlet
>>> Error]-[com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$5
>>> incompatible with com.sun.xml.bind.v2.model.impl.ClassInfoImpl]:
>>> java.lang.ClassCastException:
>>> com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$5
>>> incompatible with com.sun.xml.bind.v2.model.impl.ClassInfoImpl
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind.v2.model.impl.ClassInfoImpl.getBaseClass(ClassInfoImpl.java:
>>> 171)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind
>>> .v2
>>> .model
>>> .impl.RuntimeClassInfoImpl.getBaseClass(RuntimeClassInfoImpl.java:
>>> 61)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind
>>> .v2
>>> .model
>>> .impl.RuntimeClassInfoImpl.getBaseClass(RuntimeClassInfoImpl.java:
>>> 41)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:149)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind
>>> .v2
>>> .model
>>> .impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:55)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind
>>> .v2
>>> .model
>>> .impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
>>> at
>>> com
>>> .sun
>>> .xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:
>>> 196)
>>> at
>>> com
>>> .sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:56)
>>> at
>>> com
>>> .sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:
>>> 33)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind
>>> .v2
>>> .model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:22)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind
>>> .v2
>>> .model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:15)
>>> at
>>> com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl
>>> $1.get(ElementPropertyInfoImpl.java:38)
>>> at
>>> com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl
>>> $1.get(ElementPropertyInfoImpl.java:41)
>>> at java.util.AbstractList$Itr.next(AbstractList.java:437)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:146)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind
>>> .v2
>>> .model
>>> .impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:55)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind
>>> .v2
>>> .model
>>> .impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
>>> at
>>> com
>>> .sun
>>> .xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:
>>> 196)
>>> at
>>> com
>>> .sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:56)
>>> at
>>> com
>>> .sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:
>>> 33)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind
>>> .v2
>>> .model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:22)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind
>>> .v2
>>> .model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:15)
>>> at
>>> com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl
>>> $1.get(ElementPropertyInfoImpl.java:38)
>>> at
>>> com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl
>>> $1.get(ElementPropertyInfoImpl.java:41)
>>> at java.util.AbstractList$Itr.next(AbstractList.java:437)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:146)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind
>>> .v2
>>> .model
>>> .impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:55)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind
>>> .v2
>>> .model
>>> .impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
>>> at
>>> com
>>> .sun
>>> .xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:
>>> 196)
>>> at
>>> com
>>> .sun
>>> .xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:
>>> 211)
>>> at
>>> com
>>> .sun
>>> .xml
>>> .bind
>>> .v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:383)
>>> at
>>> com
>>> .sun
>>> .xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:
>>> 236)
>>> at
>>> com
>>> .sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:
>>> 76)
>>> at
>>> com
>>> .sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:
>>> 55)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun
>>> .reflect
>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
>>> at
>>> sun
>>> .reflect
>>> .DelegatingMethodAccessorImpl
>>> .invoke(DelegatingMethodAccessorImpl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:618)
>>> at
>>> javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
>>> at javax.xml.bind.ContextFinder.find(ContextFinder.java:368)
>>> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
>>> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .core
>>> .provider
>>> .jaxb
>>> .AbstractJAXBProvider
>>> .getStoredJAXBContext(AbstractJAXBProvider.java:180)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .core
>>> .provider
>>> .jaxb
>>> .AbstractJAXBProvider.getJAXBContext(AbstractJAXBProvider.java:173)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .core
>>> .provider
>>> .jaxb.AbstractJAXBProvider.getMarshaller(AbstractJAXBProvider.java:
>>> 151)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .core
>>> .provider
>>> .jaxb.AbstractJAXBProvider.getMarshaller(AbstractJAXBProvider.java:
>>> 130)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .core
>>> .provider
>>> .jaxb
>>> .AbstractRootElementProvider
>>> .writeTo(AbstractRootElementProvider.java:144)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .spi.container.ContainerResponse.write(ContainerResponse.java:289)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .server
>>> .impl
>>> .application
>>> .WebApplicationImpl._handleRequest(WebApplicationImpl.java:1029)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .server
>>> .impl
>>> .application
>>> .WebApplicationImpl.handleRequest(WebApplicationImpl.java:941)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .server
>>> .impl
>>> .application
>>> .WebApplicationImpl.handleRequest(WebApplicationImpl.java:932)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .spi.container.servlet.WebComponent.service(WebComponent.java:384)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .spi
>>> .container.servlet.ServletContainer.service(ServletContainer.java:
>>> 451)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .spi
>>> .container.servlet.ServletContainer.service(ServletContainer.java:
>>> 632)
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:
>>> 1145)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:
>>> 1086)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:118)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:834)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:682)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .servlet.ServletWrapper.handleRequest(ServletWrapper.java:588)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .wswebcontainer
>>> .servlet.ServletWrapper.handleRequest(ServletWrapper.java:489)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .webapp
>>> .WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:321)
>>> at
>>> de.lvm.services.util.ServiceFilter.doFilter(ServiceFilter.java:170)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:
>>> 190)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:834)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:
>>> 744)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:
>>> 697)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .wswebcontainer
>>> .filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:
>>> 121)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .extension
>>> .DefaultExtensionProcessor
>>> .invokeFilters(DefaultExtensionProcessor.java:833)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .webcontainer
>>> .extension
>>> .DefaultExtensionProcessor
>>> .handleRequest(DefaultExtensionProcessor.java:771)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .wswebcontainer
>>> .extension
>>> .DefaultExtensionProcessor
>>> .handleRequest(DefaultExtensionProcessor.java:113)
>>> at
>>> com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:
>>> 3453)
>>> at
>>> com
>>> .ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:
>>> 267)
>>> at
>>> com
>>> .ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:
>>> 815)
>>> at
>>> com
>>> .ibm
>>> .ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:
>>> 1466)
>>> at
>>> com
>>> .ibm
>>> .ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .http
>>> .channel
>>> .inbound
>>> .impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .http
>>> .channel
>>> .inbound
>>> .impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .http
>>> .channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:
>>> 267)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .tcp
>>> .channel
>>> .impl
>>> .NewConnectionInitialReadCallback
>>> .sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .tcp
>>> .channel
>>> .impl
>>> .NewConnectionInitialReadCallback
>>> .complete(NewConnectionInitialReadCallback.java:113)
>>> at
>>> com
>>> .ibm
>>> .ws
>>> .tcp
>>> .channel
>>> .impl
>>> .AioReadCompletionListener
>>> .futureCompleted(AioReadCompletionListener.java:165)
>>> at
>>> com
>>> .ibm
>>> .io
>>> .async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:
>>> 217)
>>> at
>>> com
>>> .ibm
>>> .io
>>> .async
>>> .AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:
>>> 161)
>>> at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
>>> at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:
>>> 196)
>>> at
>>> com
>>> .ibm
>>> .io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:
>>> 751)
>>> at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
>>> at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
>>>
>>> Thanx,
>>>
>>> Robert
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>