users@jersey.java.net

Re: [Jersey] Jersey and JAXB - Which JAXB Version to use?

From: Daniel Manzke <daniel.manzke_at_googlemail.com>
Date: Tue, 23 Dec 2008 00:04:12 +0100

This seems to be class loader problem. Due something that I could not find
until now, the classes are loaded more than once. The class loader now tells
use, that this class is already there.
If anybody has an idea, scream. ;) Until there I have to debug. :)


Daniel

2008/12/22 Marc Hadley <Marc.Hadley_at_sun.com>

> See:
>
>
> https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0/jersey/dependencies.html
>
> Scroll down to the Entity section, JAXB subsection.
>
> Marc.
>
>
> On Dec 22, 2008, at 5:26 PM, Daniel Manzke wrote:
>
> Hi,
>>
>> which version does Jersey use?
>>
>>
>> We are developing a WebDAV solution for the jersey stack and Markus
>> switched his String version to a JAXB version. For that he hand-coded the
>> java classes to match the right xml. For using this classes we need Jersey
>> to know the our jaxb context. Paul mentioned that we should implement a
>> Context-Resolver. This was done really fast, due the fact that this is no
>> rocket science. :)
>> Due some namespace problems I added the jaxb-impl.jar to my classpath, but
>> this ends in duplicate entries in the jaxb context.
>>
>> Stacktrace:
>>
>> 22.12.2008 23:13:01 com.sun.xml.bind.v2.runtime.reflect.opt.Injector
>> inject
>> FEIN: Unable to inject
>> net/java/webdav/elements/Status$JaxbAccessorM_getStatus_setStatus_java_lang_String
>> java.lang.reflect.InvocationTargetException
>> 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
>> com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java:181)
>> at
>> com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java:85)
>> at
>> com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.prepare(AccessorInjector.java:87)
>> at
>> com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.get(OptimizedAccessorFactory.java:113)
>> at
>> com.sun.xml.bind.v2.runtime.reflect.Accessor$GetterSetterReflection.optimize(Accessor.java:365)
>> at
>> com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.<init>(TransducedAccessor.java:231)
>> at
>> com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor.get(TransducedAccessor.java:173)
>> at
>> com.sun.xml.bind.v2.runtime.property.ValueProperty.<init>(ValueProperty.java:77)
>> at
>> com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:106)
>> at
>> com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:171)
>> at
>> com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:481)
>> at
>> com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:315)
>> at
>> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
>> at
>> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
>> 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:202)
>> at javax.xml.bind.ContextFinder.find(ContextFinder.java:363)
>> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
>> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
>> at
>> net.java.webdav.jaxb.WebDAVElementsProvider.getContext(WebDAVElementsProvider.java:70)
>> //my implementtation
>> at
>> net.java.webdav.jaxb.WebDAVElementsProvider.getContext(WebDAVElementsProvider.java:1)
>> at
>> com.sun.jersey.impl.provider.entity.AbstractJAXBProvider.getJAXBContext(AbstractJAXBProvider.java:168)
>> at
>> com.sun.jersey.impl.provider.entity.AbstractJAXBProvider.getMarshaller(AbstractJAXBProvider.java:158)
>> at
>> com.sun.jersey.impl.provider.entity.AbstractJAXBProvider.getMarshaller(AbstractJAXBProvider.java:131)
>> at
>> com.sun.jersey.impl.provider.entity.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:110)
>> at
>> com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:251)
>> at
>> com.sun.jersey.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:752)
>> at
>> com.sun.jersey.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:692)
>> at
>> com.sun.jersey.impl.container.httpserver.HttpHandlerContainer.handle(HttpHandlerContainer.java:173)
>> at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:65)
>> at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:65)
>> at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:68)
>> at
>> sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:552)
>> at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:65)
>> at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:524)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>> at java.lang.Thread.run(Thread.java:619)
>> Caused by: java.lang.LinkageError: loader (instance of
>> sun/misc/Launcher$AppClassLoader): attempted duplicate class definition
>> for name:
>> "net/java/webdav/elements/Status$JaxbAccessorM_getStatus_setStatus_java_lang_String"
>> at java.lang.ClassLoader.defineClass1(Native Method)
>> at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
>> at java.lang.ClassLoader.defineClass(ClassLoader.java:466)
>> ... 45 more
>>
>> <WebDAVElementsProvider.java>---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
> ---
> Marc Hadley <marc.hadley at sun.com>
> CTO Office, Sun Microsystems.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>


-- 
Mit freundlichen Grüßen
Daniel Manzke