Bug 745907 (EDG-119)

Summary: NPE during REST get
Product: [JBoss] JBoss Data Grid 6 Reporter: Michal Linhard <mlinhard>
Component: InfinispanAssignee: Default User <jbpapp-maint>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 6.0.0CC: galder.zamarreno, jdg-bugs, mlinhard, nobody
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/EDG-119
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-24 21:57:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
rest-test.zip none

Description Michal Linhard 2011-07-19 14:39:13 UTC
project_key: EDG

simple sequence

put key "test" value "test" (serialized to byte array, with MIME type application/x-java-serialized-object)
get key "test" Content-type: text/plain

causes:
{code}
16:37:05,877 SEVERE [org.jboss.resteasy.core.SynchronousDispatcher] (http-test1-192.168.11.101-8080-1) Failed executing GET /rest/___defaultcache/test: org.jboss.resteasy.spi.WriterException: java.lang.NullPointerException
	at org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:262) [resteasy-jaxrs-2.2.1.GA.jar:]
	at org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:579) [resteasy-jaxrs-2.2.1.GA.jar:]
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:500) [resteasy-jaxrs-2.2.1.GA.jar:]
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.2.1.GA.jar:]
	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.2.1.GA.jar:]
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.2.1.GA.jar:]
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.2.1.GA.jar:]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]
	at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [jbossweb-7.0.0.CR4.jar:7.1.0.Alpha1-SNAPSHOT]
	at java.lang.Thread.run(Thread.java:662) [:1.6.0_25]
Caused by: java.lang.NullPointerException
	at com.thoughtworks.xstream.mapper.ClassAliasingMapper.addClassAlias(ClassAliasingMapper.java:44) [xstream-1.3.1.jar:]
	at com.thoughtworks.xstream.XStream.alias(XStream.java:939) [xstream-1.3.1.jar:]
	at com.thoughtworks.xstream.XStream.setupAliases(XStream.java:588) [xstream-1.3.1.jar:]
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:443) [xstream-1.3.1.jar:]
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:385) [xstream-1.3.1.jar:]
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:323) [xstream-1.3.1.jar:]
	at org.infinispan.rest.Server.xstream(Server.scala:51) [classes:]
	at org.infinispan.rest.Server$$anonfun$getEntry$1$$anonfun$apply$2.apply(Server.scala:71) [classes:]
	at org.infinispan.rest.Server$$anonfun$getEntry$1$$anonfun$apply$2.apply(Server.scala:71) [classes:]
	at org.infinispan.rest.Server$$anon$1.write(Server.scala:90) [classes:]
	at org.jboss.resteasy.plugins.providers.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:32) [resteasy-jaxrs-2.2.1.GA.jar:]
	at org.jboss.resteasy.plugins.providers.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:17) [resteasy-jaxrs-2.2.1.GA.jar:]
	at org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:117) [resteasy-jaxrs-2.2.1.GA.jar:]
	at org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.write(GZIPEncodingInterceptor.java:63) [resteasy-jaxrs-2.2.1.GA.jar:]
	at org.jboss.resteasy.core.interception.MessageBodyWriterContextImpl.proceed(MessageBodyWriterContextImpl.java:123) [resteasy-jaxrs-2.2.1.GA.jar:]
	at org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:250) [resteasy-jaxrs-2.2.1.GA.jar:]
	... 20 more

{code}

Comment 1 Michal Linhard 2011-07-19 14:41:01 UTC
rest-test.zip - project with the test case

Comment 2 Michal Linhard 2011-07-19 14:41:01 UTC
Attachment: Added: rest-test.zip


Comment 3 Galder ZamarreƱo 2011-07-21 09:18:51 UTC
Trustin emailed me about this and I must say it looks odd. Michal, does it happen with any REST server call?

I was wondering whether this is an issue with AS7's modular classloading.

Comment 4 Michal Linhard 2011-07-21 11:07:31 UTC
It's an AS7 classloading issue:
The problem is in modules/com/thoughtworks/xstream/main/
it doesn't declare it's dependency on module javax.api. It tries to load the class "javax.security.auth.Subject" and fails (and doesn't count with the failure, therefore the NPE)
This should be probably

However I still wonder why it tries to use xstream - it's for application/xml and there's no such thing mentioned in the testcase.

Comment 5 Michal Linhard 2011-07-21 11:08:48 UTC
fix: declare the dependency in  modules/com/thoughtworks/xstream/main/module.xml
{code}
<module xmlns="urn:jboss:module:1.0" name="com.thoughtworks.xstream">
    <resources>
        <resource-root path="xstream-1.3.1.jar"/>
        <!-- Insert resources here -->
    </resources>

    <dependencies>
        <module name="javax.api"/>
    </dependencies>
</module>
{code}

Comment 6 Trustin Lee 2011-07-24 21:57:54 UTC
Committed the suggested fix.  Thanks Michal!

Comment 7 Anne-Louise Tangring 2011-10-11 17:09:38 UTC
Docs QE Status: Removed: NEW