1 Reply Latest reply on Aug 4, 2009 8:33 PM by Jozef Hartinger

    RESTeasy 1.1 GA and Seam 2.1 integration failure

    Piotr Guziorski Newbie

      Hi,
      I need to integrate my seam application with RESTEasy framework. Currently I have one stateless bean called LoggingModule withone method log(). I'd like to expose it as a restful webservice.


      Here's the code of stateless bean:




      package com.bosch.mADM3.BasicServices.logging.services;
      
      import java.text.SimpleDateFormat;
      import java.util.Date;
      
      import javax.ejb.Stateless;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      import javax.persistence.Query;
      
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.log.Log;
      
      import com.bosch.common.containers.MetaDataContainer;
      import com.bosch.common.random.RandomString;
      import com.bosch.mADM3.BasicServices.cofiguration.ConfigurationManager;
      import com.bosch.mADM3.BasicServices.logging.entity.LogEntry;
      import com.bosch.mADM3.BasicServices.logging.entity.LogRequest;
      
      @Stateless
      @Name("LoggingModuleBean")
      public class LoggingModule implements LoggingModuleLocal, LoggingModuleRemote {
      
              @PersistenceContext EntityManager entityManager;
              @Logger Log log;
              
              public void log(String level,String logData) throws Exception
              {
                // implementation, not really relevant
              }
      
      }





      And restful service class:



      package com.bosch.mADM3.BasicServices.logging.services;
      
      import javax.ws.rs.POST;
      import javax.ws.rs.Path;
      import javax.ws.rs.ProduceMime;
      
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      
      @Name("LoggingModuleServiceRestful")
      @Path("/services/restful")
      
      public class LoggingModuleServiceRestful {
              
              @In(create=true) LoggingModuleLocal LoggingModuleBean;
              
              @POST
              @Path("/LoggingModule")
              @ProduceMime("text/plain")
              public void putLog(String level, String logData) throws Exception {
                      LoggingModuleBean.log(level, logData);
              }
              
      }





      I did not make any changes in web.xml. According to seam documentation (My Link) there is no need to modify web.xml if default annotated settings are sufficient for users requirements. So I've tried to access my service under: http://localhost:8080/mADM3BasicServices/seam/resources/services/rest/LoggingModule


      What I get in return is access denied error,
      Here's the stack trace:




      09:10:19,297 WARN  [ExceptionFilter] handling uncaught exception
      javax.servlet.ServletException: Servlet execution threw an exception
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:313)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
              at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:51)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
              at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
              at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
              at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.NoClassDefFoundError: org/resteasy/spi/ResteasyProviderFactory
              at org.jboss.seam.resteasy.ResteasyResourceAdapter.getResource(ResteasyResourceAdapter.java:132)
              at org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:80)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              ... 40 more





      I see that jboss reasteasy integration jar tries to allocate org/resteasy/spi/ResteasyProviderFactory which is incorrect, because ResteasyProviderFactory exists in resteasy-jaxrs-1.1.GA.jar in org.jboss.resteasy.spi package.


      Is there any way to fix it?


      My configuration is as follows:
      JBoss 4.2.3 GA, JBoss seam 2.1.0 SP1, reasteasy 1.1 GA


      Thanks in advance