hstaudacher / osgi-jax-rs-connector

An OSGi - JAX-RS 2.0 Connector, software repository available on the link below
http://hstaudacher.github.io/osgi-jax-rs-connector
Other
191 stars 98 forks source link

Test 4.2.0 RC1 #67

Closed hstaudacher closed 9 years ago

hstaudacher commented 9 years ago

Hi All, today I did a build for the 4.2 version of the connector. This is a link to the RC1: https://dl.dropboxusercontent.com/u/5808972/com.eclipsesource.jaxrs.repository-4.2.0-RC1.zip

I will publish it on next monday if no one complains.

@kaikreuzer can you also do a test again?

stefanseifert commented 9 years ago

can you publish a snapshot to https://oss.sonatype.org/content/repositories/snapshots/ as well? it's easier to test from a maven build then.

kaikreuzer commented 9 years ago

@kaikreuzer can you also do a test again?

Will do so on Friday!

hstaudacher commented 9 years ago

The RC1 is deployed to https://oss.sonatype.org/content/repositories/snapshots/ now

kaikreuzer commented 9 years ago

Holger, I just tested it and have the same effect as on the last version - the REST API does not start up at all. I tried to briefly debug it and see in my IDE this NPE:

java.lang.NullPointerException
    at com.eclipsesource.jaxrs.publisher.internal.JAXRSConnector.registerResource(JAXRSConnector.java:143)
    at com.eclipsesource.jaxrs.publisher.internal.JAXRSConnector.registerResource(JAXRSConnector.java:125)
    at com.eclipsesource.jaxrs.publisher.internal.JAXRSConnector.doAddResource(JAXRSConnector.java:119)
    at com.eclipsesource.jaxrs.publisher.internal.JAXRSConnector.addResource(JAXRSConnector.java:113)
    at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.delegateAddService(ResourceTracker.java:45)
    at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.addingService(ResourceTracker.java:39)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
    at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
    at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
    at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
    at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:914)

Checking the code I see that in JAXRSConnector line 142 the contextMap is empty and thus there is no jerseyContext. Do you have any idea how this can happen?

kaikreuzer commented 9 years ago

I should add that it successfully passes the same line of code a few times before the NPE happens - so in other situations, the jerseyContext is correctly available.

kaikreuzer commented 9 years ago

Some further observations: On my RaspPi, I am actually not seeing these exceptions, but the REST API still does not come up (404). After restarting the publisher bundle, the servlet seems to be there and I get a 500 with

15:43:04.717 ERROR o.g.j.m.i.WriterInterceptorExecutor[:245] - MessageBodyWriter not found for media type=application/json, type=class org.eclipse.smarthome.io.rest.internal.resources.beans.RootBean, genericType=class org.eclipse.smarthome.io.rest.internal.resources.beans.RootBean.

It somehow seems as if the gson provider is not found as the com.google.gson bundle actually stays in resolved state. The service seems to be correctly registered though:

osgi> b 83
com.eclipsesource.jaxrs.provider.gson_2.1.0.201412030617 [83]
  Id=83, Status=ACTIVE      Data Root=/opt/openhab/runtime/server/configuration/org.eclipse.osgi/83/data
  "Registered Services"
    {com.eclipsesource.jaxrs.provider.gson.GsonProvider}={service.id=121, service.bundleid=83, service.scope=singleton}
  No services in use.
  Exported packages
    com.eclipsesource.jaxrs.provider.gson; version="2.1.0"[exported]
  Imported packages
    com.google.gson; version="2.2.4" <com.google.gson_2.2.4.v201311231704 [4]>
    javax.ws.rs; version="2.0.0" <com.eclipsesource.jaxrs.jersey-all_2.13.0 [84]>
    javax.ws.rs.core; version="2.0.0" <com.eclipsesource.jaxrs.jersey-all_2.13.0 [84]>
    javax.ws.rs.ext; version="2.0.0" <com.eclipsesource.jaxrs.jersey-all_2.13.0 [84]>
    org.osgi.framework; version="1.8.0" <org.eclipse.osgi_3.10.0.v20140606-1445 [0]>
  No fragment bundles
  No required bundles

Hope this helps you any further!

hstaudacher commented 9 years ago

Thanks for testing @kaikreuzer. I will investigate and provide another RC asap

hstaudacher commented 9 years ago

@kaikreuzer I tested the RC again with all our applications and examples. It works without problems. Can you provide your example for me? Best would be archived eclipse projects with a target platform config and a launch config included ;)

kaikreuzer commented 9 years ago

I have uploaded my IDE setup here, I hope it works: https://dl.dropboxusercontent.com/u/15535378/jaxrsconnector-tests.zip Just import everything into Eclipse and set targetplatform/openhab.target as your TP.

One question that I came across: Why does your jersey-all bundle contain all original libs in the target/dependency folder? I thought that you repackage the sources in this bundle - aren't the libs hence duplicating the included classes?

hstaudacher commented 9 years ago

Thanks, will check it in the next days.

hstaudacher commented 9 years ago

Hey @kaikreuzer I have created the workspace, everything compiles. The good news is, I found the problem. The Jersey implementation sometimes throws an exception during shutdown. I handled it previously as an IllegalArgumentException. I seems they have changed it to be an IllegallStateException. The connector impl is more tolerant now regarding the shutdown exceptions.

I will provide an RC2 build and open an issue for this. Can you test the RC2 again?

Regarding the target folder. I think you are right, this is done using the Maven bundle plugin. I will open a separate issue for this.

kaikreuzer commented 9 years ago

I will open a separate issue for this.

Did you do so already or shall I? As this should reduce the size by about 4MB, this would be actually very important for RaspPi support as well - size matters a lot on embedded hardware!

hstaudacher commented 9 years ago

Yes, see #69