title: Getting RestEASY, HIbernate, Maven and JBossAS5.1 to play nicely
body: <p>I'm trying to build a restful webservice that uses hibernate for data access.  I am using Maven to build and have to deploy on JBossAS5.1 - probably EAP5.x in future.</p>
  
  <p>RestEASY is fine, but I'm having issues with Hibernate, as soon as I add hibernate dependencies to pom.xml the resulting WAR crashes immediately after deploy.</p>
  
  <p>I'm reasonably comfortable with Java and Maven but am new to JavaEE beyond simple JSP. </p>
  
  <p>pom.xml extract:</p>
  
  <pre><code>      &lt;repositories&gt;
            &lt;repository&gt;
                &lt;id&gt;jboss&lt;/id&gt;
                &lt;name&gt;jboss repo&lt;/name&gt;
                &lt;url&gt;http://repository.jboss.org/nexus/content/groups/public/&lt;/url&gt;
            &lt;/repository&gt;
        &lt;/repositories&gt;
  
      &lt;dependencies&gt;
          &lt;!-- hibernate --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;3.5.6-Final&lt;/version&gt;
           &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                  &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;  
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;          
  
      &lt;/dependency&gt;
           &lt;dependency&gt;
              &lt;groupId&gt;javax.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;persistence-api&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
          &lt;/dependency&gt;
  
        &lt;dependency&gt;
            &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
            &lt;artifactId&gt;resteasy-jaxrs&lt;/artifactId&gt;
            &lt;version&gt;2.0.0.GA&lt;/version&gt;
            &lt;exclusions&gt;
                &lt;exclusion&gt;
                    &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;
                    &lt;artifactId&gt;jaxb-impl&lt;/artifactId&gt;
                &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                    &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                    &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
                &lt;/exclusion&gt; 
                 &lt;exclusion&gt;
                    &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                    &lt;artifactId&gt;slf4j-simple&lt;/artifactId&gt;
                &lt;/exclusion&gt;
                &lt;exclusion&gt;
                    &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                    &lt;artifactId&gt;jcl-over-slf4j&lt;/artifactId&gt;
                &lt;/exclusion&gt; 
            &lt;/exclusions&gt; 
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
            &lt;artifactId&gt;resteasy-jaxb-provider&lt;/artifactId&gt;
            &lt;version&gt;2.0.0.GA&lt;/version&gt;
             &lt;exclusions&gt;
                &lt;exclusion&gt;
                    &lt;groupId&gt;com.sun.xml.bind&lt;/groupId&gt;
                    &lt;artifactId&gt;jaxb-impl&lt;/artifactId&gt;
                &lt;/exclusion&gt;
            &lt;/exclusions&gt; 
        &lt;/dependency&gt;
  
    &lt;build&gt;
      &lt;finalName&gt;hedgehog-rest&lt;/finalName&gt;
      &lt;plugins&gt; 
          &lt;plugin&gt; 
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; 
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; 
              &lt;configuration&gt; 
                  &lt;source&gt;1.6&lt;/source&gt; 
                  &lt;target&gt;1.6&lt;/target&gt; 
              &lt;/configuration&gt; 
          &lt;/plugin&gt;   
      &lt;/plugins&gt;
    &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>web.xml:</p>
  
  <pre><code>&lt;web-app&gt;
     &lt;display-name&gt;Archetype Created Web Application&lt;/display-name&gt;
     &lt;context-param&gt;
        &lt;param-name&gt;resteasy.scan&lt;/param-name&gt;
        &lt;param-value&gt;true&lt;/param-value&gt;
     &lt;/context-param&gt;
     &lt;listener&gt;
        &lt;listener-class&gt;org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap&lt;/listener-class&gt;
     &lt;/listener&gt;
     &lt;servlet&gt;
        &lt;servlet-name&gt;Resteasy&lt;/servlet-name&gt;
        &lt;servlet-class&gt;org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher&lt;/servlet-class&gt;
     &lt;/servlet&gt;
     &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;Resteasy&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
     &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>I removed all my code except this class:</p>
  
  <pre><code>@Path("/echo")
  public class Echo 
  {
      @GET
      @Produces("text/*")
      @Path("/{message}")
      public Response echoService(@PathParam("message") String message)
      {
          return Response.status(200).entity(message).build();
      }
  }
  </code></pre>
  
  <p>Beginning of error log below:</p>
  
  <pre><code>20:37:05,848 INFO  [TomcatDeployment] deploy, ctxPath=/hedgehog-rest
  20:37:06,956 INFO  [ConfigurationBootstrap] Adding scanned resource: com.ecs.hedgehog.Echo
  20:37:07,057 ERROR [[/hedgehog-rest]] Exception sending context initialized event to listener instance of class org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
  java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate MessageBodyReader
      at org.jboss.resteasy.plugins.providers.RegisterBuiltin.register(RegisterBuiltin.java:36)
      at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:171)
      at org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap.contextInitialized(ResteasyBootstrap.java:28)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
  </code></pre>