1 Reply Latest reply on Feb 4, 2009 7:41 PM by mscbug

    GWT and Seam Remoting Problems

    mscbug

      Hi,


      I am playing around with GWT and Seam using RPC to receive data from the server. The GWT remoting example which comes with the Seam distribution runs just fine, but when I try to make a RPC call I get this error.


      The requested resource (/seam/resource/gwt) is not available.


      I use:
      Seam 2.0.1.GA
      JBoss 4.2.2.GA
      gwt-mac-1.5.3



      My files:


      The synchron interface:


      public interface ReportingService extends RemoteService
      {
          public ReportingDTO getReportingData();
      }
      



      The asynchron interface:


      public interface ReportingServiceAsync extends RemoteService
      {
          public void getReportingData(AsyncCallback<ReportingDTO> callback);
      }
      
      



      my interface inplementation:


      @Name("at.foo.mts.view.gwt.client.ReportingService")
      public class ReportingServiceImpl implements ReportingService
      {
          @WebRemote
          public ReportingDTO getReportingData()
          {
              ReportingDTO dto = new ReportingDTO();
              dto.setName("test");
              return dto;
          }
      }
      



      my web.xml (the remoting part):


      ...
      <servlet>
           <servlet-name>Seam Resource Servlet</servlet-name>
           <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
      </servlet>
      <servlet-mapping>
           <servlet-name>Seam Resource Servlet</servlet-name>
           <url-pattern>/seam/resource/*</url-pattern>
      </servlet-mapping>
      ...
      



      I compile the gwt client code and copy the output during deployment to the root folder of the exploded war. The folder structure of the ear looks like this:


      mts.ear
          jboss-seam.jar
          lib
          ...
          mts.war
              foo.xhtml
              foo.xml
              reporting.html
              ... all js files compiled by the gwt compiler
      ...
      



      after deployment and starting the server I can run the app in hosted mode and in the browser.


      http://localhost:8080/mts/reporting.html


      All looks pretty good, but when I try to make a RPC call, the error described above occurs. (resource not found)


      The lookup for the reporting service looks like this:


      private ReportingServiceAsync getReportingService()
          {
              ReportingServiceAsync rs = (ReportingServiceAsync) GWT.create(ReportingService.class);
              ServiceDefTarget endpoint = (ServiceDefTarget) rs;
              String endpointURL = GWT.getHostPageBaseURL() + "seam/resource/gwt";        
              endpoint.setServiceEntryPoint(endpointURL);
              return rs;
          }
      



      For the String endpointURL I tried all kinds of combinations, but no one worked. When you see the code, it looks pretty much like the gwt example in the seam examples remoting package, there it works, in my case not, and I have no clue why.
      Although I am new to Seam, to me it looks like the endpointURL is not handled by the seam resource servlet.


      I hope anyone can help.


      Thanks in advance, markus

        • 1. Re: GWT and Seam Remoting Problems
          mscbug

          Hi,


          I found the error. The problem was the missing gwt-servlet.jar in the lib folder of the ear file.
          The problem I have now is already described here: http://www.seamframework.org/Community/GWTRPCCallFails.


          But as written it should be already fixed in Seam. Does anyone know which version of Seam I have to use in order to get the content type problem fixed? I use Seam 2.0.1.GA


          Here is my stacktrace:


          javax.servlet.ServletException: Content-Type must be 'text/plain' with 'charset=utf-8' (or unspecified charset)
               at org.jboss.seam.remoting.gwt.GWTService.readPayloadAsUtf8(GWTService.java:446)
               at org.jboss.seam.remoting.gwt.GWTService.access$000(GWTService.java:32)
               at org.jboss.seam.remoting.gwt.GWTService$1.process(GWTService.java:140)
               at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53)
               at org.jboss.seam.remoting.gwt.GWTService.getResource(GWTService.java:130)
               at org.jboss.seam.servlet.SeamResourceServlet.doGet(SeamResourceServlet.java:75)
               at org.jboss.seam.servlet.SeamResourceServlet.doPost(SeamResourceServlet.java:92)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
               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:68)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
               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:141)
               at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
               at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
               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:179)
               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(Thread.java:613)
          



          thx, markus