Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Orbit » Can not use Wink 1.2.1 as JAX RS implementation in an Eclipse product(Can not use Wink 1.2.1 as JAX RS implementation in an Eclipse product)
Can not use Wink 1.2.1 as JAX RS implementation in an Eclipse product [message #1756188] Mon, 13 March 2017 16:39
Omar KACIMI is currently offline Omar KACIMIFriend
Messages: 1
Registered: March 2017
Junior Member
I am currently writing an Eclipse product including an embedded jetty. The embedded jetty is encapsulating a wink application. I am using wink 1.2.1 incubating in the eclipse product by wrapping the library as an Eclipse plugin and using the JAX RS 1.1.1 bundle from the orbit build number: R20151221205849.

Initially, i had the following exception when i run my Eclipse product:

java.lang.NullPointerException at org.apache.wink.common.internal.http.Accept.valueOf(Accept.java:139) at org.apache.wink.server.internal.contexts.HttpHeadersImpl.getAcceptHeader(HttpHeadersImpl.java:152) at org.apache.wink.server.internal.contexts.HttpHeadersImpl.getAcceptableMediaTypes(HttpHeadersImpl.java:106) at org.apache.wink.server.internal.registry.ResourceRegistry.filterByProduces(ResourceRegistry.java:558) at org.apache.wink.server.internal.registry.ResourceRegistry.filterDispatchMethods(ResourceRegistry.java:482) at org.apache.wink.server.internal.registry.ResourceRegistry.findSubResourceMethod(ResourceRegistry.java:391) at org.apache.wink.server.internal.handlers.FindResourceMethodHandler.handleSubResourceMethod(FindResourceMethodHandler.java:168) at org.apache.wink.server.internal.handlers.FindResourceMethodHandler.handleRequest(FindResourceMethodHandler.java:110) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22) at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63) at org.apache.wink.server.internal.handlers.FindRootResourceHandler.handleRequest(FindRootResourceHandler.java:95) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22) at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63) at org.apache.wink.server.internal.handlers.HeadMethodHandler.handleRequest(HeadMethodHandler.java:53) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22) at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63) at org.apache.wink.server.internal.handlers.OptionsMethodHandler.handleRequest(OptionsMethodHandler.java:46) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22) at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63) at org.apache.wink.server.internal.handlers.SearchResultHandler.handleRequest(SearchResultHandler.java:33) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22) at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63) at org.apache.wink.server.internal.log.ResourceInvocation.handleRequest(ResourceInvocation.java:92) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22) at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63) at org.apache.wink.server.internal.log.Requests.handleRequest(Requests.java:76) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26) at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22) at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63) at org.apache.wink.server.handlers.AbstractHandlersChain.run(AbstractHandlersChain.java:48) at org.apache.wink.server.internal.RequestProcessor.handleRequestWithoutFaultBarrier(RequestProcessor.java:207) at org.apache.wink.server.internal.RequestProcessor.handleRequest(RequestProcessor.java:154) at org.apache.wink.server.internal.servlet.RestServlet.service(RestServlet.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:366) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:231) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at org.eclipse.jetty.io.nio.SslConnection.handle(SslConnection.java:196) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)

An answer on stackoverflow suggests that the cause is a conflict of another jax rs implementation with wink:

"
The problem was that JAX-RS implementation provided by jboss 7 was conflicting with Apache Wink, we had to disable jboss impl completely by commenting the contents of module.xml under JBOSS_HOME\modules\system\layers\base\javax\ws\rs\api\main to stop loading the Jboss JAX-RS API and it worked fine
"

Indeed, after investigating FactoryFinder.find(String factoryId, String fallbackClassName) in JAX RS it turns out that JAX RS falls back to the default jersey implementation because the class loader can not load the name of the JAX RS class implementation from the META-INF/services/javax.ws.rs.ext.runtimeDeletage file located in the wink common eclipse plugin I bundled.

I suspected that this is an issue with the osgi class loading as the class loader of the JAX RS plugin can not see resources in plugins that JAX RS does not depend on. Accordingly, I changed the Eclipse buddy policy of the JAX RS plugin on my machine to "Eclipse-BuddyPolicy: registered" and registered the Wink common plugin with JAX RS using "Eclipse-RegisterBuddy: javax.Ws.rs Require-Bundle: javax.Ws.rs" .

The exception now is avoided and the product can be correctly run. Now my question is the following: does the JAX RS plugin on orbit need to be changed to work with other JAX RS implementation such as wink or there are other options that I'm missing?

Please take into consideration the fact that I can not upgrade to JAX RS 2.0 nor use a different implementation of JAX RS as I am using OSLC4J which is dependent on wink.
Previous Topic:news.eclipse.org is shutting down.
Next Topic:Upgrade to Apache Batik 1.9.0 in Oxygen Update?
Goto Forum:
  


Current Time: Tue Nov 20 05:24:23 GMT 2018

Powered by FUDForum. Page generated in 0.01931 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top