Hey Marc,
the jax-rs-whiteboard uses Apache CXF as its JAX-RS implementation. It
is directly using CXFNonSpringServlet and other CXF artifacts so I guess
it is not possible to use it with Jersey.
Do you wanted to use Jersey for any specific reason?
Carlos.
El 5/1/17 a las 14:34, [email protected] escribió:
Hello everyone
I am currently giving the jax-rs-whiteboard a test. My goal is a
REST-Service which uses Spring-Hateoas to create the necessary links.
The provided sample uses the enroute-jsonrpc as a provider as far as I
could see and I am trying to get this running with CXF and Jersey.
Unfortunately I am running in some classloading issues:
jaxws.ws.rs-api uses a ServiceLocator and tries to load
org.glassfish.jersey.internal.RuntimeDelegateImplwhich cannot be found
(see StackTrace and Bundles at the end).
I am not very familiar with the BundleWiring and what classes are
visible when using the Classloader from this Class as done here
https://github.com/apache/aries-jax-rs-whiteboard/blob/master/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/activator/CXFJaxRsBundleActivator.java#L96-L108
So my question is: has anyone tried to use jax-rs-whiteboard with
jersey yet and what dependencies are necessary?
Or is this a bug and the bundle must be fixed for example by using a
dynamic-import header?
13:26:37.380 DEBUG [main] javax.ws.rs-api - BundleEvent STARTING -
javax.ws.rs-api
13:26:37.380 DEBUG [main] javax.ws.rs-api - BundleEvent STARTED -
javax.ws.rs-api
13:26:37.381 DEBUG [main] org.apache.aries.jax.rs.whiteboard -
BundleEvent STARTING - org.apache.aries.jax.rs.whiteboard
13:26:37.384 INFO [paxweb-config-1-thread-1]
org.eclipse.jetty.util.log - Logging initialized @1781ms
13:26:37.385 DEBUG [main] javax.ws.rs.ext.FactoryFinder - Unable to
load provider class org.glassfish.jersey.internal.RuntimeDelegateImpl
using custom classloader
org.apache.felix.framework.BundleWiringImpl$BundleClassLoaderJava5
trying again with current classloader.
java.lang.ClassNotFoundException:
org.glassfish.jersey.internal.RuntimeDelegateImpl not found by
org.apache.aries.jax.rs.whiteboard [29]
at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)
at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:107)
at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:225)
at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:135)
at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:120)
at
org.apache.aries.jax.rs.whiteboard.activator.CXFJaxRsBundleActivator.initRuntimeDelegate(CXFJaxRsBundleActivator.java:103)
at
org.apache.aries.jax.rs.whiteboard.activator.CXFJaxRsBundleActivator.start(CXFJaxRsBundleActivator.java:61)
at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2226)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2144)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
at aQute.launcher.Launcher.update(Launcher.java:483)
at aQute.launcher.Launcher.activate(Launcher.java:382)
at aQute.launcher.Launcher.run(Launcher.java:276)
at aQute.launcher.Launcher.main(Launcher.java:133)
13:26:37.396 DEBUG [paxweb-config-1-thread-1]
o.e.j.u.component.ContainerLifeCycle -
org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper@775d53e4
added {qtp830199975{STOPPED,8<=0<=200,i=0,q=0},AUTO}
13:26:37.396 WARN [main] org.jvnet.hk2.logger - Cannot find a default
implementation of the HK2 ServiceLocatorGenerator
! Failed to start bundle
org.apache.aries.jax.rs.whiteboard-0.0.1.201701041146, exception
activator error java.lang.ClassNotFoundException: Provider
org.glassfish.jersey.internal.RuntimeDelegateImpl could not be
instantiated: java.lang.IllegalStateException: No generator was
provided and there is no default generator registered from:
javax.ws.rs.ext.RuntimeDelegate:findDelegate#152
13:26:37.396 DEBUG [main] org.apache.aries.jax.rs.whiteboard -
BundleEvent STOPPING - org.apache.aries.jax.rs.whiteboard
13:26:37.396 DEBUG [main] org.apache.aries.jax.rs.whiteboard -
BundleEvent STOPPED - org.apache.aries.jax.rs.whiteboard
START LEVEL 1
ID|State |Level|Name
0|Active | 0|System Bundle (5.6.1)|5.6.1
1|Active | 1|Java Servlet API (3.1.0)|3.1.0
2|Active | 1|Apache Felix Metatype Service (1.1.2)|1.1.2
3|Active | 1|Apache Felix Bundle Repository (2.0.8)|2.0.8
4|Active | 1|Apache Felix Configuration Admin Service
(1.8.12)|1.8.12
5|Active | 1|Apache Felix EventAdmin (1.4.8)|1.4.8
6|Active | 1|Apache Felix File Install (3.5.6)|3.5.6
7|Active | 1|Apache Felix Gogo Command (1.0.0)|1.0.0
8|Active | 1|Apache Felix Gogo Runtime (1.0.0)|1.0.0
9|Active | 1|Apache Felix Gogo Shell (1.0.0)|1.0.0
10|Active | 1|Apache Felix Declarative Services (2.0.6)|2.0.6
11|Active | 1|Jetty :: Http Utility
(9.3.14.v20161028)|9.3.14.v20161028
12|Active | 1|Jetty :: IO Utility
(9.3.14.v20161028)|9.3.14.v20161028
13|Active | 1|Jetty :: Security
(9.3.14.v20161028)|9.3.14.v20161028
14|Active | 1|Jetty :: Server Core
(9.3.14.v20161028)|9.3.14.v20161028
15|Active | 1|Jetty :: Servlet Handling
(9.3.14.v20161028)|9.3.14.v20161028
16|Active | 1|Jetty :: Utilities
(9.3.14.v20161028)|9.3.14.v20161028
17|Active | 1|Jetty :: XML utilities
(9.3.14.v20161028)|9.3.14.v20161028
18|Active | 1|OPS4J Pax Logging - API (1.9.1)|1.9.1
19|Active | 1|OPS4J Pax Logging - Logback Service (1.9.1)|1.9.1
20|Active | 1|Apache XBean OSGI Bundle Utilities
(4.6.0.SNAPSHOT)|4.6.0.SNAPSHOT
21|Active | 1|Apache XBean :: Classpath Resource Finder
(4.6.0.SNAPSHOT)|4.6.0.SNAPSHOT
22|Active | 1|OPS4J Pax Web - API
(6.0.1.SNAPSHOT)|6.0.1.SNAPSHOT
23|Active | 1|OPS4J Pax Web - Jetty
(6.0.1.SNAPSHOT)|6.0.1.SNAPSHOT
24|Active | 1|OPS4J Pax Web - Runtime
(6.0.1.SNAPSHOT)|6.0.1.SNAPSHOT
25|Active | 1|OPS4J Pax Web - Service SPI
(6.0.1.SNAPSHOT)|6.0.1.SNAPSHOT
26|Active | 1|ASM all classes with debug info
(6.0.0.ALPHA)|6.0.0.ALPHA
27|Active | 1|osgi.poc.hateoas (0.0.0)|0.0.0
28|Active | 1|javax.ws.rs-api (2.0.1)|2.0.1
29|Active | 1|JSON in Java (20160810.0.0)|20160810.0.0
30|Active | 1|XmlSchema Core (2.2.1)|2.2.1
31|Active | 1|javax.annotation API (1.3.0)|1.3.0
32|Active | 1|HK2 API module (2.5.0.b31)|2.5.0.b31
33|Active | 1|ServiceLocator Default Implementation
(2.5.0.b31)|2.5.0.b31
34|Active | 1|OSGi resource locator bundle - used by various
API providers that rely on META-INF/services mechanism to locate
providers. (1.0.1)|1.0.1
35|Active | 1|HK2 Implementation Utilities
(2.5.0.b31)|2.5.0.b31
36|Active | 1|jersey-repackaged-guava (2.25.0)|2.25.0
37|Active | 1|jersey-core-common (2.25.0)|2.25.0
38|Active | 1|Javassist (3.21.0.GA)|3.21.0.GA
39|Active | 1|jersey-core-client (2.25.0)|2.25.0
40|Active | 1|Bean Validation API (1.1.0.Final)|1.1.0.Final
41|Active | 1|aopalliance version 1.0 repackaged as a module
(2.5.0.b31)|2.5.0.b31
42|Active | 1|jersey-core-server (2.25.0)|2.25.0
43|Active | 1|jersey-container-servlet-core (2.25.0)|2.25.0
44|Active | 1|javax.inject:1 as OSGi bundle
(2.5.0.b31)|2.5.0.b31
45|Resolved | 1|Apache Aries JAX-RS Whiteboard
(0.0.1.201701041146)|0.0.1.201701041146
regards
Marc