2 Replies Latest reply on Aug 7, 2008 4:47 PM by Immo Benjes

    Problems with Seam Remoting when using components created with @Factory

    Immo Benjes Newbie

      Hi,


      I am having problems with Seam Remoting. <s:remote include="xxx"/> exits with an Exception and the included JavaScript file is empty.


      When I use the following class and use <s:remote include="remotetest"/> everything is fine.


      |@Stateful
      @Name("remotetest")
      public class RemoteTestBean implements RemoteTest {
           public String sayHello(String name){
                return "Hello "+name;
           }
           @Destroy @Remove
           public void clean(){};
      }|



      And the Interface:


      @Local
      public interface RemoteTest {
      
           @WebRemote
           public abstract String sayHello(String name);
           
           public void clean();
      
      }



      So far so good. But now I have a class which outjects a Seam component with the name 'remote'
      using the Factory annotation.



      @Name("outjectTest")
      public class OutjectTest implements OutjectTestInterface {
           
           @In(create=true)
           @Out
           RemoteTestBean remote;
           
           @Factory("remote")
           public void createRemote(){
                remote = new RemoteTestBean();
           }
      
           public RemoteTestBean getRemote() {
                return remote;
           }
      
           public void setRemote(RemoteTestBean remote) {
                this.remote = remote;
           }
      }
      




      public interface OutjectTestInterface {
      
           public abstract void createRemote();
      
           public abstract RemoteTestBean getRemote();
      
           public abstract void setRemote(RemoteTestBean remote);
      
      }



      Now <s:remote include="remote"/> causes an Exception because the component 'remote' cannot be found. Am I doing something wrong or is this not supposed to work.
      I've played around with In and Out options but that doesn't seem to change anything.


      How would you access multiple instances of the same component? (My pages has multiple components of the same type on the same page).


      Any help is welcome. Thanks


      Immo


      1:30:06,848 ERROR [InterfaceGenerator] Component not found: [remote]
      11:30:06,938 ERROR [ContextualHttpServletRequest] ended request due to exception
      javax.servlet.ServletException: Invalid request - component not found.
           at org.jboss.seam.remoting.InterfaceGenerator$1.process(InterfaceGenerator.java:93)
           at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53)
           at org.jboss.seam.remoting.InterfaceGenerator.handle(InterfaceGenerator.java:64)
           at org.jboss.seam.remoting.Remoting.getResource(Remoting.java:111)
           at org.jboss.seam.servlet.SeamResourceServlet.doGet(SeamResourceServlet.java:75)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
           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.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:154)
           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
           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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
           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(Unknown Source)