10 Replies Latest reply on Sep 5, 2013 1:09 PM by tkalafut

    Resteasy not working anymore on AS7

    osnetwork

      Hello everyone,

       

      I have a problem with an application that I'm trying to migrate from AS6 to AS7.

      It seems that Resteasy is not working for for some REST call where the Body of the Request is supposed to map a Java object.

       

      This is my Server side rest method annotations

      @POST

                @Path("action/bet")

                @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })

                @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })

                ResponseDTO sendBettingAction(@Context SecurityContext sec, BettingTicket ticket);

      Here is the POJO which I'm trying to serialize from XML

      @XmlRootElement(name = "betting-ticket")

      @XmlAccessorType(XmlAccessType.FIELD)

      @XmlType(propOrder = { "command", "idGametable", "idPlayer", "betValue", "type" })

      public class BettingTicket extends AbstractBettingTicket {

       

                private static final long serialVersionUID = 6907760191262653485L;

       

                public BettingTicket() {

                          // TODO Auto-generated constructor stub

                }

      }

       

      @XmlTransient

      public abstract class AbstractBettingTicket implements Serializable {

       

                private static final long serialVersionUID = 6907760191262653485L;

       

                @XmlElement

                protected BettingCommand command;

                @XmlElement

                protected long idGametable;

                @XmlElement

                protected long idPlayer;

                @XmlElement

                protected BigDecimal betValue;

                @XmlElement

                protected GametableType type;

       

      // getters and setters...

      }

      And here is the error that I get on the server side when I'm performing the POST request

      18:32:37,892 SEVERE [org.jboss.resteasy.core.SynchronousDispatcher] (http-localhost-127.0.0.1-8080-45) Failed executing POST clientgame/action/bet: org.jboss.resteasy.spi.InternalServerErrorException: Bad arguments passed to public abstract org.test.remote.dto.ResponseDTO org.test.portone.service.GameClientResource.sendBettingAction(javax.ws.rs.core.SecurityContext,org.test.remote.testgame.tickets.BettingTicket)  (

      org.jboss.resteasy.plugins.server.servlet.ServletSecurityContext org.jboss.resteasy.plugins.server.servlet.ServletSecurityContext@18e59762,

      org.jboss.resteasy.spi.BadRequestException org.jboss.resteasy.spi.BadRequestException: Could not find message body reader for type: class org.test.remote.testgame.tickets.BettingTicket of content type: application/xml;charset="utf-8" )

                at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:181) [resteasy-jaxrs-2.2.1.GA.jar:]

                at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:255) [resteasy-jaxrs-2.2.1.GA.jar:]

                at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:220) [resteasy-jaxrs-2.2.1.GA.jar:]

                at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:209) [resteasy-jaxrs-2.2.1.GA.jar:]

                at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:519) [resteasy-jaxrs-2.2.1.GA.jar:]

                at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:496) [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.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]

                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:480) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]

                at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.0.2.Final.jar:7.0.2.Final]

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at java.lang.Thread.run(Thread.java:662) [:1.6.0_27]

      Caused by: java.lang.IllegalArgumentException: argument type mismatch

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_27]

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_27]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_27]

                at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_27]

                at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140) [resteasy-jaxrs-2.2.1.GA.jar:]

                ... 29 more

      I thought it was a problem with some missing jars but in my META-INF dependencies I have the following packages:

      org.slf4j, javax.ws.rs.api, javax.servlet.api, org.jboss.resteasy.resteasy-atom-provider, org.jboss.resteasy.resteasy-jackson-provider, org.jboss.resteasy.resteasy-multipart-provider

      Any help would be much appreciated.

       

      Thanks in advance,

      LM

        • 1. Re: Resteasy not working anymore on AS7
          osnetwork

          I have partially solved, I have added the following dependencies in the META-INF file of my war and now the exception is gone

          org.jboss.resteasy.resteasy-jaxrs

          However, now the BettingTicket POJO is populated with only null values so I start to think that all the JAXB annotations are somehow ignored.

          • 2. Re: Resteasy not working anymore on AS7
            osnetwork

            Unfortunately I was worng in my last post. We haven't been able to fix the behaviour of RESTeasy on JBoss 7.0.x and now we have been giving a try on JBoss 7.1.0.Final too and we have the same problem. Basically if the REST call is going to use a POJO class, this class doesn't get recognized or populated with the values on the server side

            21:50:52,958 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/pn-portone].[org.test.portone.PortoneApplication]] (http-localhost.localdomain-127.0.0.1-8080-41) Servlet.service() for servlet org.test.portone.PortoneApplication threw exception: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException

                      at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:340) [resteasy-jaxrs-2.3.1.GA.jar:]

                      at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214) [resteasy-jaxrs-2.3.1.GA.jar:]

                      at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190) [resteasy-jaxrs-2.3.1.GA.jar:]

                      at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:540) [resteasy-jaxrs-2.3.1.GA.jar:]

                      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) [resteasy-jaxrs-2.3.1.GA.jar:]

                      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.1.GA.jar:]

                      at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.1.GA.jar:]

                      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.1.GA.jar:]

                      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.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.10.Final.jar:]

                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]

                      at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489) [jbossweb-7.0.10.Final.jar:]

                      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]

                      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]

                      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]

                      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]

            Caused by: java.lang.NullPointerException

            The NPE is because the object the implementation of this method

            ResponseDTO sendBettingAction(@Context SecurityContext sec, @Form BettingTicket ticket);

            is trying to use the BettingTicket object, which is null.

             

            The strange thing is that all this code works without problem on all JBAS 6 and 6.1 while the problem on JBAS7.x is coming only from methods which use serialization and deserialization.

            Also, I have noticed these warnings during the deployment of the web application. Most of them are about resteasy libraries

            21:43:41,081 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("com.sun.xml.bind:main") which may be changed or removed in future versions without notice.

            21:43:41,083 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.jboss.resteasy.resteasy-jaxrs:main") which may be changed or removed in future versions without notice.

            21:43:41,093 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.jboss.resteasy.resteasy-atom-provider:main") which may be changed or removed in future versions without notice.

            21:43:41,094 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.jboss.resteasy.resteasy-jackson-provider:main") which may be changed or removed in future versions without notice.

            21:43:41,171 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.jboss.resteasy.resteasy-multipart-provider:main") which may be changed or removed in future versions without notice.

            21:43:41,175 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.jboss.as.jpa:main") which may be changed or removed in future versions without notice.

            21:43:41,176 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.javassist:main") which may be changed or removed in future versions without notice.

            21:43:41,177 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.codehaus.jackson.jackson-core-asl:main") which may be changed or removed in future versions without notice.

            21:43:41,178 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.codehaus.jackson.jackson-mapper-asl:main") which may be changed or removed in future versions without notice.

            21:43:41,179 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.codehaus.jackson.jackson-xc:main") which may be changed or removed in future versions without notice.

            21:43:41,188 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.codehaus.jackson.jackson-jaxrs:main") which may be changed or removed in future versions without notice.

            21:43:41,192 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.apache.log4j:main") which may be changed or removed in future versions without notice.

            21:43:41,197 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("com.sun.xml.bind:main") which may be changed or removed in future versions without notice.

            21:43:41,211 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.jboss.resteasy.resteasy-jaxrs:main") which may be changed or removed in future versions without notice.

            21:43:41,212 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.jboss.resteasy.resteasy-atom-provider:main") which may be changed or removed in future versions without notice.

            21:43:41,214 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.jboss.resteasy.resteasy-jackson-provider:main") which may be changed or removed in future versions without notice.

            21:43:41,229 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.jboss.resteasy.resteasy-multipart-provider:main") which may be changed or removed in future versions without notice.

            21:43:41,232 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.apache.commons.lang:main") which may be changed or removed in future versions without notice.

            21:43:41,238 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.jboss.as.jpa:main") which may be changed or removed in future versions without notice.

            21:43:41,250 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.javassist:main") which may be changed or removed in future versions without notice.

            21:43:41,251 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.codehaus.jackson.jackson-core-asl:main") which may be changed or removed in future versions without notice.

            21:43:41,252 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.codehaus.jackson.jackson-mapper-asl:main") which may be changed or removed in future versions without notice.

            21:43:41,259 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.codehaus.jackson.jackson-xc:main") which may be changed or removed in future versions without notice.

            21:43:41,261 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.Test.ear.pn-portone.war" is using a private module ("org.codehaus.jackson.jackson-jaxrs:main") which may be changed or removed in future versions without notice.

            As Manifest entries I have the following packages

            <Dependencies>org.slf4j, com.sun.xml.bind services export, javax.ws.rs.api, javax.servlet.api, org.jboss.resteasy.resteasy-jaxrs, org.jboss.resteasy.resteasy-atom-provider, org.jboss.resteasy.resteasy-jackson-provider, org.jboss.resteasy.resteasy-multipart-provider, org.test.common</Dependencies>

             

            I hope somebody has some ideas because this problem is basically the last step which prevent us to move from JBAS6.x to JBAS7.x.

             

            Thanks in advance

            • 3. Re: Resteasy not working anymore on AS7
              osnetwork

              More tests. I'm testing on JBAS 7.1.1.Final

              The NPE was coming because I have tried using the @Form annotation in my service method, however once I remove the @Form annotation I get this error:

              11:24:26,862 SEVERE [org.jboss.resteasy.core.SynchronousDispatcher] (http-localhost.localdomain-127.0.0.1-8080-1) Failed executing POST /clientgame/action/bet: org.jboss.resteasy.spi.BadRequestException: Could not find message body reader for type: class org.test.remote.testgame.tickets.BettingTicket of content type: application/xml;charset="UTF-8"

                        at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:153) [resteasy-jaxrs-2.3.2.Final.jar:]

                        at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:124) [resteasy-jaxrs-2.3.2.Final.jar:]

                        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:147) [resteasy-jaxrs-2.3.2.Final.jar:]

                        at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) [resteasy-jaxrs-2.3.2.Final.jar:]

                        at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) [resteasy-jaxrs-2.3.2.Final.jar:]

                        at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211) [resteasy-jaxrs-2.3.2.Final.jar:]

                        at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525) [resteasy-jaxrs-2.3.2.Final.jar:]

                        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) [resteasy-jaxrs-2.3.2.Final.jar:]

                        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.2.Final.jar:]

                        at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.2.Final.jar:]

                        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.2.Final.jar:]

                        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.2.Final.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.13.Final.jar:]

                        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                        at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

                        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489) [jbossweb-7.0.13.Final.jar:]

                        at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

                        at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

                        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

                        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

                        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]

              The POST request is the following

              Content-Type: application/xml

               

              <?xml version="1.0" encoding="UTF-8"?><betting-ticket><command>Player Bet</command><idGametable>34</idGametable><idPlayer>50</idPlayer><betValue>10</betValue><type>Test game</type></betting-ticke>

              The BettingTicket POJO class was extending from an abstract class, I have tried to get rid of the abstract class as a test, but the result is the same.

              The weird thing is that I have GETs which @Produces correct XML code from these POJO classes, but it is wrong when it needs to use @Consumes.

               

              My application class looks like this

              @ApplicationPath("/")

              public class PortoneApplication extends Application {

               

              }

              Here is my web.xml file

              <?xml version="1.0" encoding="UTF-8"?>

              <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"

                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

               

                        <display-name>PN-Portone</display-name>

               

                        <security-constraint>

                                  <web-resource-collection>

                                            <web-resource-name>Resteasy</web-resource-name>

                                            <url-pattern>/*</url-pattern>

                                            <http-method>GET</http-method>

                                            <http-method>POST</http-method>

                                  </web-resource-collection>

                                  <auth-constraint>

                                            <role-name>admin</role-name>

                                            <role-name>user</role-name>

                                  </auth-constraint>

                        </security-constraint>

                        <login-config>

                                  <auth-method>BASIC</auth-method>

                                  <realm-name>resteasy</realm-name>

                        </login-config>

                        <security-role>

                                  <role-name>admin</role-name>

                        </security-role>

                        <security-role>

                                  <role-name>user</role-name>

                        </security-role>

               

              </web-app>

              Hope someone has an idea

              • 4. Re: Resteasy not working anymore on AS7
                osnetwork

                I have done some steps forward and I actually start to think that the problem is related to the classloading of my BettingTicket class.

                 

                Basically, this class is included in a separate jar library from the RESTfull war. It is still a dependency though but it seems like it doesn't like the annotations on it while it is in a separate jar.

                This remote library is available through Jboss modules. Here is how I load the module:

                <?xml version="1.0" encoding="UTF-8"?>

                <module xmlns="urn:jboss:module:1.1" name="org.test.remote">

                <resources>

                   <resource-root path="test-remote.jar"/>

                </resources>

                <dependencies>

                   <module name="javax.api"/>

                   <module name="com.sun.xml.bind"/>

                   <module name="org.codehaus.jackson.jackson-core-asl"/>

                   <module name="org.codehaus.jackson.jackson-mapper-asl"/>

                   <module name="org.codehaus.jackson.jackson-xc"/>

                   <module name="org.codehaus.jackson.jackson-jaxrs"/>

                </dependencies>

                </module>

                I have run a simple test, I have created a clone BettingTicket class inside the RESTfull project and the values gets populated in the java class.

                 

                I need that class to be in a separate library because is shared among different projects (EJBs, WARs, jars). How can I possibly fix this?

                • 5. Re: Resteasy not working anymore on AS7
                  osnetwork

                  I can confirm that the problem with RESTeasy is due to annotated POJO classes outside of the WAR. In fact that behaviour was working on JBAS6, so it seems that there are some problems related to the scanning of these pojo classes which are annotated.

                   

                  I'm having the same issue with @Form and @FormParam. I have annotated a POJO class with @FormParam in an external jar (outside the WAR of RESTeasy) and all the values are null. Instead if I move the same annotated class inside the WAR project, it works.

                   

                  I don't think that this can be considered as a bad design to have annotated POJO outside the WAR (model classes, DTOs, or things like that should be shared among different projects), and in my opinion it should be raised as bug because RESTeasy on JBAS6 was working with that configuration.

                   

                  I have found somebody else with a very similar problem, unfortunately he got no answer like me...

                  http://sourceforge.net/mailarchive/forum.php?thread_name=4B7BFCD4.30305%40redhat.com&forum_name=resteasy-developers

                  • 6. Re: Resteasy not working anymore on AS7
                    newbieprog

                    I have the same error. Did you manage to find a solution?

                    • 7. Re: Resteasy not working anymore on AS7
                      ctomc

                      Luca (i know this is late anwser),

                       

                      what do you mean by external jar? where is it then packed as module? and if it is how do you import it?

                      if it is packed as module you have to explicitly import annotations as well othewise they wont be seen to deployment.

                       

                       

                      --

                      tomaz

                      • 8. Re: Resteasy not working anymore on AS7
                        osnetwork

                        @newbieprog I have found no solution to fix the problem. However the only workaround I could find is to duplicate the POJO classes that are used for rest calls, and place a copy of them in the REST war. It's an horrible solution but in this way RESTeasy sees the annotation of these POJO.

                         

                        @Tomaz Cerar by external jar I mean that it is packed as module. I have posted the module.xml of the library previously. The way it si imported, like for every other library, is by adding the package of my library in the manifest dependencies of the RESTeasy application.

                        • 9. Re: Resteasy not working anymore on AS7
                          ctomc

                          Luca,

                           

                          this problem is solvable ,but it will require bit extra work...

                           

                          by default annotations are not exported/imported in/to modules, you have to

                          1. explicitly provide annotation index
                          2. explicitly import annotations from that module

                           

                          to provide annotation index you have to run jandex (few examples of running it http://javahowto.blogspot.com/2012/08/how-to-run-jboss-jandex.html)

                          but basicly it is java -jar jandex-1.0.3.jar <path-to-your-jar-with-annotations>

                           

                          it will output .idx file where all annotations are indexed.

                          next add that .idx(you can name it whatever) to your module.

                          add that .idx in module.xml as additional resource path

                           

                          when you have done that, import your module with annotations something like that:

                           

                          Dependencies: my.module annotations, some.other.module

                           

                          other important thing to note! your module needs to have all dependancies defined for example, you have dependances to jax-rs and resteasy you need to defined that that are module dependancies.

                           

                          you do not need to add additional resteasy dependanices in your war but to your module! your war will get them automaticly....

                           

                          --

                          tomaz

                          • 10. Re: Resteasy not working anymore on AS7
                            tkalafut

                            I just came across this problem.  Eventually I figured out that it was because we used "annox:annotate" in our xsd file that our object model was being generated from.