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
190 stars 98 forks source link

bundle installation order influences detection of @Provider #30

Closed dcaillia closed 10 years ago

dcaillia commented 10 years ago

I have an app containing jackson (8 bundles to take care of json mapping - using 2.2.2 with handcoded manifest fixes).

If the ss lists your com.eclipsesource bundles before the jackson bundles (com.eclipsesource bundles having a lower id than jackson), the @Providers in the jackson are NOT active (nor printed under Message Body Readers:/Writers:).

Using an eclipse launch config based on a set of features: If i then uncheck the osgi-jaxrs-connector feature, run, and re-check the osgi-jaxrs-connector feature and run again (to influence the ordering of the bundle resolution), then the jackson providers are found, printed and active. If i do ss now, i see that the 2 com.eclipsesource are at the end of the list, having larger ids than the jackson bundles.

So i conclude that there's some ordering problem.

Note that stop/starting the com.eclipsesource bundles in the first setup does not help: the jackson providers stay undetected: if the system happens to start with com.eclipsesource bundles having a lower id than jackson-bundles, the jackson-providers are not seen.

Is this normal (am i supposed to use start levels to get it under control?), or is it a bug (any ordering should work out - or stop/starting the connector should trigger rescanning all active bundles for providers)?

hstaudacher commented 10 years ago

Are the jackson providers registered as OSGi services? If not the publisher can't detect them.

Basically the publisher has an all service tracker. He gets all existing services and all new ones. So, I assume tha tthe jackson providers are not OSGi services. Please reopen if I'm wrong.

larsp commented 10 years ago

jackson-jaxrs-providersis working out of the box (beginning with version 2.3.1 from yesterday). Just make sure that org.glassfish.jersey.core.jersey-common is activated before the provider gets activated.