users@jersey.java.net

Re: [Jersey] Classloader problem with Felix/Jetty

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 24 May 2010 10:49:32 +0200

On May 22, 2010, at 11:39 AM, Jakub Podlesak wrote:

> Hi Jörg,
>
> this error occurs, when you start jersey-server bundle before the
> jersey-core bundle.
> I need to fix that, but in the meantime, could you please try to
> make sure the jersey-core bundle
> gets started first? Does it work for you?
>
> Regarding the ability to run Jersey on Felix, we have two samples
> showcasing that, which are continuously being tested
> on Felix without issues (see [1] and [2]). You can get detailed
> information on the test configuration we are using
> in the functional-test modules there.
>
> Does it help?
>

Can we add a chapter to the user guide explaining what is current
supported and linking to the samples?

Paul.

> ~Jakub
>
> [1]http://download.java.net/maven/2/com/sun/jersey/samples/helloworld-osgi-webapp/1.3-SNAPSHOT/helloworld-osgi-webapp-1.3-SNAPSHOT-project.zip
> [2]http://download.java.net/maven/2/com/sun/jersey/samples/osgi-http-service/1.3-SNAPSHOT/osgi-http-service-1.3-SNAPSHOT-project.zip
>
> Jörg Richter wrote:
>> Hi,
>>
>> there is a problem runnig Jersey with Felix/Jetty:
>>
>> org.osgi.framework.BundleException: Activator start error in
>> bundle ...
>> at org.apache.felix.framework.Felix.activateBundle(Felix.java:1807)
>> ...
>> Caused by: java.lang.ExceptionInInitializerError
>> at
>> com
>> .sun
>> .jersey
>> .core
>> .spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:
>> 157)
>> ...
>> Caused by: java.lang.NullPointerException
>> at javax.ws.rs.core.MediaType.valueOf(MediaType.java:119)
>> at com.sun.jersey.core.header.MediaTypes.<clinit>(MediaTypes.java:
>> 58)
>> MediaTypes.java line 58 is:
>>
>> public final static MediaType WADL =
>> MediaType.valueOf("application/vnd.sun.wadl+xml");
>>
>> So, apparently the reader for mimetype application/vnd.sun.wadl+xml
>> is missing.
>> This is possibly because all the provider classes from
>> com.sun.jersey.core.impl.provider.header are not loaded, as
>> suggested by a bunch of preceding warnings. In particular:
>>
>> WARNING: The class
>> com.sun.jersey.core.impl.provider.header.MediaTypeProvider
>> implementing the provider interface
>> com.sun.jersey.spi.HeaderDelegateProvider is not found. The
>> provider implementation is ignored.
>> So, this seems to be a classloader problem in conjunction with Felix.
>>
>> The software environment is up-to-date:
>> - Felix 2.0.5
>> - Bundle "Apache Felix Http Jetty" 2.0.4, which embeds Jetty 6.1.21
>> - Jersey 1.3-SNAPSHOT (May 21)
>> With Jersey 1.2 the same problem occurs.
>>
>> I would love to run Jersey in Felix/Jetty!
>>
>> Cheers,
>> Jörg Richter
>>
>>
>> ---------------------------------------------------------------------
>> 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
>