5 Replies Latest reply on Nov 20, 2007 2:48 PM by dhartford

    ejb3/seam-gwt-remoting/gwt

    dhartford

      I'm trying to expose an existing ejb3 method so many other GWT web applications can access it directly through SEAM remoting.


      error
      ==========
      Exception while dispatching incoming RPC call

      java.lang.RuntimeException: Type cannot be determined for component

      [Component(com.domain.app.gwt.client.QueryGwtService)]. Please ensure that it has a local interface.
      at
      org.jboss.seam.remoting.gwt.GWTToSeamAdapter.callWebRemoteMethod(GWTT
      oSeamAdapter.java:88)
      ======


      EJB3 SIDE:
      ===========
      package com.domain.app.ejb;
      @Stateless
      //Name is the GWT sych service
      @Name("com.domain.app.gwt.client.QueryGwtService")
      public class QueryGwt implements QueryGwtLocal {

      @WebRemote
      public String gwtTest2(){
      return "test ok";
      }

      }
      ------
      package com.domain.app.ejb;
      @Local
      public interface QueryGwtLocal {
      @WebRemote
      public String gwtTest2();
      }
      -----
      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar 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/ejb-jar_3_0.xsd">

      <!-- SEAM 2.0 support -->


      <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>


      <assembly-descriptor>
      <interceptor-binding>
      <ejb-name>*</ejb-name>
      <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
      </interceptor-binding>
      </assembly-descriptor>
      </ejb-jar>
      -----------
      empty seam.properties in the root of the jar.
      =============

      Is this all you need to do for the EJB3/server side so it can be consumed by may other GWT web applications?


      Sample GWT side:
      =========
      <?xml version="1.0" encoding="UTF-8"?>
      <components ....>

      <core:init
      jndi-pattern="my-ear-app/#{ejbName}/local"
      debug="false"/>

      <core:manager conversation-timeout="120000"/>


      --------
      <web-app>

      <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>


      <servlet-name>Seam Resource Servlet</servlet-name>
      <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>

      <servlet-mapping>
      <servlet-name>Seam Resource Servlet</servlet-name>

      <!--DRH modified url-pattern to match how GWT app works -->
      <url-pattern>/com.domain.app.gwt.HelloWorld/seam/resource/*</url-pattern>
      </servlet-mapping>
      </web-app>
      -----------
      package com.domain.app.gwt.client;
      public interface QueryGwtService extends RemoteService{
      public String gwtTest2();
      }
      ----------
      package com.domain.app.gwt.client;
      public interface QueryGwtServiceAsync{
      public void gwtTest2(AsyncCallback callback);
      }
      --------
      //sample call to get service
      private QueryGwtServiceAsync getService()
      {
      String endpointURL = GWT.getModuleBaseURL() + "seam/resource/gwt";
      QueryGwtServiceAsync svc = (QueryGwtServiceAsync) GWT.create(QueryGwtService.class);
      ((ServiceDefTarget) svc).setServiceEntryPoint(endpointURL);
      return svc;
      }
      =========




      My concern is, the example says to put the GWT Sych interface/service on the EJB3 side, which does not make sense as multiple GWT apps could use it and would need to copy that interface again.

      Any pointers please? Thanky,
      -D