1 Reply Latest reply on Oct 8, 2009 3:05 PM by joseph.dimi_mcclane.yahoo.de

    Seam Remoting: not a Function error

    joseph.dimi_mcclane.yahoo.de

      Hallo,


      I am trying to test Seam Remoting in Seam 2.1. Basically i followed documentation, but i am getting a xxx is not a Function-error in my browser.


      I found this topic: http://seamframework.org/Community/NotAFunctionErrorInSEAMRemoting
      This is exactly my problem. The interface for my Seam Component doesnt have any methods at all (i checked interface.js?myComponent).


      web.xml


      <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>



      Seam Component:



      @Stateful
      @Name("draw")
      public class DrawBean implements Draw
      {
          private int value = 50;
      
          @WebRemote 
          public int getValue()
          {
              return value;
          }
       
          @WebRemote
          public void setValue(int value)
          {
              this.value = value;
          }
      }



      Interface:


      @Local
      public interface Draw
      {
          @WebRemote
          public int getValue(); 
          @WebRemote
          public void setValue(int value);
      
          public void destroy();
      }



      .xhtml:



      <s:remote include="draw"/>



      I even set:




      Seam.Remoting.resourcePath = "http://localhost:8080/myApp/seam/resource
      
      /remoting";



      (found it in some topic here)


      Anyway i get:


      Seam.Component.getInstance("draw").getValue() is not a Function



      The guy in the topic i found solved it by putting additional libs (jboss-seam-remoting.jar,jsf-facelets.jar) into EAR scope. I am new to Seam/Java, so i just copied the jars to the EarContent folder of my (Eclipse)JBossTools generated project. It didnt help. Any help is really appreciated!


        • 1. Re: Seam Remoting: not a Function error
          joseph.dimi_mcclane.yahoo.de

          The Problem is related to Jboss Tools . While generating a new Seam Project, seam-remoting.jar is put into WebContent/WEB-INF/lib, while it should go into EAR-Libraries to make Remoting work.


          Just add seam-remoting.jar (from seam lib directory) as an external jar (Properties- Java EE Module Dependencies) to the xxx-ear project part. And make sure you check the added jar under Module Dependencies of xxx-ejb und xxx parts. This made Seam Remoting work for me.