SRVE0777E:应用程序类'org.apache.wink.common.internal.http.Accept.valueOf抛出的异常:139'

时间:2013-11-07 12:35:04

标签: apache-wink websphere-liberty

我在WLP 8.5.5 ApacheWink上的JAX-RS服务中遇到以下异常 (WebSphere Application Server 8.5.5.0/wlp-1.0.3.20130510-0831)

@POST
@Path("hello")
@Consumes(MediaType.APPLICATION_JSON)
public Response sayhello(Hello hi) {
    String obj = "hello received";

    return Response.ok().entity(obj).build();
}

异常

[AUDIT   ] CWWKF0011I: The server defaultServer is ready to run a smarter planet.
[WARNING ] SRVE9967W: The manifest class path jaxb-api.jar can not be found in jar file wsjar:file:/C:/apps/wlp/usr/servers/defaultServer/dropins/WasLibertyJaxRS-1.0-SNAPSHOT.war!/WEB-INF/lib/jaxb-impl-2.2.3-1.jar or its parent.
[WARNING ] SRVE9967W: The manifest class path activation.jar can not be found in jar file wsjar:file:/C:/apps/wlp/usr/servers/defaultServer/dropins/WasLibertyJaxRS-1.0-SNAPSHOT.war!/WEB-INF/lib/jaxb-impl-2.2.3-1.jar or its parent.
[WARNING ] SRVE9967W: The manifest class path jsr173_1.0_api.jar can not be found in jar file wsjar:file:/C:/apps/wlp/usr/servers/defaultServer/dropins/WasLibertyJaxRS-1.0-SNAPSHOT.war!/WEB-INF/lib/jaxb-impl-2.2.3-1.jar or its parent.
[WARNING ] SRVE9967W: The manifest class path jaxb1-impl.jar can not be found in jar file wsjar:file:/C:/apps/wlp/usr/servers/defaultServer/dropins/WasLibertyJaxRS-1.0-SNAPSHOT.war!/WEB-INF/lib/jaxb-impl-2.2.3-1.jar or its parent.
[WARNING ] SRVE9967W: The manifest class path jaxb-api.jar can not be found in jar file wsjar:file:/C:/apps/wlp/usr/servers/defaultServer/dropins/WasLibertyJaxRS-1.0-SNAPSHOT.war!/WEB-INF/lib/jaxb-impl-2.2.3-1.jar or its parent.
[WARNING ] SRVE9967W: The manifest class path activation.jar can not be found in jar file wsjar:file:/C:/apps/wlp/usr/servers/defaultServer/dropins/WasLibertyJaxRS-1.0-SNAPSHOT.war!/WEB-INF/lib/jaxb-impl-2.2.3-1.jar or its parent.
[WARNING ] SRVE9967W: The manifest class path jsr173_1.0_api.jar can not be found in jar file wsjar:file:/C:/apps/wlp/usr/servers/defaultServer/dropins/WasLibertyJaxRS-1.0-SNAPSHOT.war!/WEB-INF/lib/jaxb-impl-2.2.3-1.jar or its parent.
[WARNING ] SRVE9967W: The manifest class path jaxb1-impl.jar can not be found in jar file wsjar:file:/C:/apps/wlp/usr/servers/defaultServer/dropins/WasLibertyJaxRS-1.0-SNAPSHOT.war!/WEB-INF/lib/jaxb-impl-2.2.3-1.jar or its parent.
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://localhost:9080/WasLibertyJaxRS-1.0-SNAPSHOT/
[AUDIT   ] CWWKZ0001I: Application WasLibertyJaxRS-1.0-SNAPSHOT started in 3.589 seconds.
[ERROR   ] An unhandled exception occurred which will be propagated to the container.
java.lang.NullPointerException
[ERROR   ] SRVE0777E: Exception thrown by application class 'org.apache.wink.common.internal.http.Accept.valueOf:139'
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:151)
    at org.apache.wink.server.internal.contexts.HttpHeadersImpl.getAcceptableMediaTypes(HttpHeadersImpl.java:105)
    at org.apache.wink.server.internal.registry.ResourceRegistry.filterByProduces(ResourceRegistry.java:573)
    at org.apache.wink.server.internal.registry.ResourceRegistry.filterDispatchMethods(ResourceRegistry.java:497)
    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:75)
    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:75)
    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:75)
    at org.apache.wink.server.internal.handlers.OptionsMethodWADLHandler.handleRequest(OptionsMethodWADLHandler.java:51)
    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:75)
    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:75)
    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:75)
    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:75)
    at org.apache.wink.server.handlers.AbstractHandlersChain.run(AbstractHandlersChain.java:60)
    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:124)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1240)
    at [internal classes]

[ERROR   ] SRVE0315E: An execption occurred: com.ibm.ws.webcontainer.webapp.WebAppErrorReport: 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:151)
    at org.apache.wink.server.internal.contexts.HttpHeadersImpl.getAcceptableMediaTypes(HttpHeadersImpl.java:105)
    at org.apache.wink.server.internal.registry.ResourceRegistry.filterByProduces(ResourceRegistry.java:573)
    at org.apache.wink.server.internal.registry.ResourceRegistry.filterDispatchMethods(ResourceRegistry.java:497)
    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:75)
    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:75)
    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:75)
    at org.apache.wink.server.internal.handlers.OptionsMethodWADLHandler.handleRequest(OptionsMethodWADLHandler.java:51)
    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:75)
    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:75)
    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:75)
    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:75)
    at org.apache.wink.server.handlers.AbstractHandlersChain.run(AbstractHandlersChain.java:60)
    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:124)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1240)
    at [internal classes]
Caused by: java.lang.NullPointerException
    ... 43 more

3 个答案:

答案 0 :(得分:1)

从堆栈跟踪看起来,客户端未发送Accept标头。但是,在我看来,NullPointerException永远不是服务器的适当错误,所以我建议在IBM开一个PMR。

答案 1 :(得分:1)

我在Jersey客户端中缺少以下JSOn配置

    ClientConfig config = new DefaultClientConfig();
    config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
    client = Client.create(config);

答案 2 :(得分:0)

当您拥有自己的wink实现和应用程序的jar时,我已经看到了类似的异常。通过

解决它

从server.xml中删除jax-rs功能 - 它与应用程序中的库冲突。

OR

根据WebSphere规范配置JAX-RS应用程序,并从应用程序中删除wink jar http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.multiplatform.doc/ae/twbs_jaxrs_implejaxrsapps_step3.html