0 Replies Latest reply on Aug 15, 2013 12:16 AM by andrew.s

    Unable to get RestEasy in JBoss 7.2 to use jackson-provider2

    andrew.s

      I am using JBoss AS 7.2.0 with an upgraded RestEasy to version 3.0.1.Final.  I am deploying an EAR with a WAR and EJB module.  The the only thing the WAR has in it is REST service.  My EJB Pojos have circular references, so I would like to use the new Jackson 2 @JsonIdentityInfo.

       

       

      The REST service is loaded via the web.xml attached.

       

      <web-app 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"

            version="3.0">

       

          <display-name>Archetype Created Web Application</display-name>

       

       

                <context-param>

                          <param-name>resteasy.scan</param-name>

                          <param-value>true</param-value>

                </context-param>

       

          <listener>

              <listener-class>

                  org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap

              </listener-class>

          </listener>

       

          <servlet>

              <servlet-name>Resteasy</servlet-name>

              <servlet-class>

                  org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher

              </servlet-class>

          </servlet>

       

       

          <servlet-mapping>

              <servlet-name>Resteasy</servlet-name>

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

          </servlet-mapping>     

      </web-app>

       

       

      I'm using all JBoss provided Jackson/JAX-RS Maven dependencies in my Maven POM files, scoped as provided.  In my EAR META-INF directory I have a jboss-deployment-structure.xml file that looks like this:

       

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

      <jboss-deployment-structure>

          <deployment>

              <exclusions>

                 <module name="org.jboss.resteasy.resteasy-jackson-provider"/>

              </exclusions>

              <dependencies>

                  <module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import"/>

              </dependencies>

          </deployment>

      </jboss-deployment-structure>

       

       

      My EJB POJO has the @JsonIdentityInfo annotation on it.  I make a call into my REST service and when the POJO is being serialized by RESTEasy (method is flagged as @Produces("application/json") I get a huge exception stack that basically ends in a stack overflow (meaning that Jackson is in the circular reference loop and not adhering to the Identity Info annotation).  The jar being used at this point is jackson-mapper-asl-1.9.12.jar and not the Jackson 2 jar.

       

      Any thoughts on what I may be doing wrong or why this isn't working as expected?  I can post additional information if needed.

       

      Thanks in advance,

      Andrew