0

I've got Sling 8. I then include Jersey and this Jersey connector in my build: https://github.com/hstaudacher/osgi-jax-rs-connector

My next step should be simply write a Jersey Service and test it, but I'm getting this Exception immediately:

27.01.2017 10:54:16.696 *ERROR* [FelixDispatchQueue] com.eclipsesource.jaxrs.publisher FrameworkEvent ERROR (org.osgi.framework.ServiceException: Service factory returned null.)org.osgi.framework.ServiceException: Service factory returned null.

and

[FelixDispatchQueue] com.eclipsesource.jaxrs.publisher FrameworkEvent ERROR (org.osgi.framework.ServiceException: Service factory exception: org/apache/felix/shell/Command)
org.osgi.framework.ServiceException: Service factory exception: org/apache/felix/shell/Command

and

Caused by: java.lang.NoClassDefFoundError: org/apache/felix/shell/Command

So I look at my bundles list in Felix, and I don't see any bundle that appears to provide this... So I find it online and install it myself. Now I get this exception:

Service factory exception: org/apache/sling/extensions/threaddump/internal/ThreadDumpCommand

and

Caused by: java.lang.NoClassDefFoundError: org/apache/sling/extensions/threaddump/internal/ThreadDumpCommand

and

Caused by: java.lang.NoClassDefFoundError: org/apache/felix/webconsole/plugins/memoryusage/internal/MemoryUsageCommand

Now, I DO have a bundle installed with this class (it's "Apache Felix Web Console Memory Usage Plugin"). So now I really don't understand what the heck is going on.

I have a feeling that I'm not supposed to be providing my own "felix shell" bundle and that the OSGI in Sling is failing to provide it...

Is anybody successfully using Sling 8 and Jersey?

lance.dolan
  • 3,493
  • 27
  • 36

1 Answers1

0

Maybe you should try with just a vanilla OSGi environment for starters. Once you have Jersey working then you can try integrating with Sling.

I have had success with jaxrs in OSGi, specifically using the Amdatu REST bundles.

https://amdatu.org/application/tutorial/step1/

With this I was able to use JAX-RS annotations to serve HTTP services:

https://github.com/figurate/figurate-core/blob/master/modules/figurate-osgi/src/main/groovy/org/figurate/osgi/http/ServiceInfo.groovy

You can see the bundles I used here:

https://github.com/figurate/figurate-core/blob/master/modules/figurate-osgi/src/test/resources/config/HttpVersionSpec.config

fortuna
  • 701
  • 5
  • 7