5 Replies Latest reply on Sep 23, 2009 10:44 PM by Greg Zoller

    Seam Remoting Newbie Question--Getting Exception

    Greg Zoller Newbie

      Hello,


      I'm trying remoting for the first time and am getting an exception.  I will be accessing the remote functionality via a trivial HTML page.
      The Java code is shown below:


      Local Interface:


      import org.jboss.seam.annotations.remoting.WebRemote;
      import javax.ejb.Local;
      
      @Local
      public interface StoreLocal {
           @WebRemote
           public String search(String query);
      }
      





      Implementation:



      import org.jboss.seam.annotations.Name;
      import javax.ejb.Stateless;
      
      @Stateless
      @Name("store")
      public class Store implements StoreLocal{
           public String search(String query) {
                return "Greg's Test Successful! :::> "+query;
           }
      }
      



      Before even testing whether the remoting is working I tried accessing the javascript file remote.js, entering the url in the browser (servlet was configured in web.xml as shown in docs).  I got this exception:


      javax.servlet.ServletException: Servlet.init() for servlet Seam Resource Servlet threw exception
           org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
           org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
           org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
           org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
           org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           java.lang.Thread.run(Unknown Source)


      root cause


      java.lang.IllegalStateException: Attempted to invoke a Seam component outside the an initialized application
           org.jboss.seam.contexts.Lifecycle.getApplication(Lifecycle.java:36)
           org.jboss.seam.contexts.Lifecycle.mockApplication(Lifecycle.java:111)
           org.jboss.seam.servlet.SeamResourceServlet.loadResourceProviders(SeamResourceServlet.java:42)
           org.jboss.seam.servlet.SeamResourceServlet.init(SeamResourceServlet.java:35)
           org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
           org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
           org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
           org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
           org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           java.lang.Thread.run(Unknown Source)



      Any ideas?
      Thanks!
      Greg

        • 1. Re: Seam Remoting Newbie Question--Getting Exception
          Greg Zoller Newbie

          Ok, I'm past this problem (corrupt JBoss server--reinstalled and all is good), but have another.


          Now when I try to call my remote search method I get this exception below.  Am I missing some additional prep/config to get remoting to work?


          Thanks for any ideas.
          Greg




          javax.servlet.ServletException: org.jboss.seam.InstantiationException: Could not instantiate Seam component: store
               at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:74)
               at org.jboss.seam.remoting.ExecutionHandler.handle(ExecutionHandler.java:78)
               at org.jboss.seam.remoting.Remoting.getResource(Remoting.java:111)
               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)
               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.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.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
               at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
               at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
               at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
               at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
               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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:51)
               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)
          Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: store
               at org.jboss.seam.Component.newInstance(Component.java:2096)
               at org.jboss.seam.Component.getInstance(Component.java:1978)
               at org.jboss.seam.Component.getInstance(Component.java:1940)
               at org.jboss.seam.Component.getInstance(Component.java:1934)
               at org.jboss.seam.remoting.Call.processInvocation(Call.java:125)
               at org.jboss.seam.remoting.Call.execute(Call.java:111)
               at org.jboss.seam.remoting.ExecutionHandler$1.process(ExecutionHandler.java:89)
               at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53)
               ... 46 more
          Caused by: javax.naming.NameNotFoundException: myapp not bound
               at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
               at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
               at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
               at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
               at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
               at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
               at javax.naming.InitialContext.lookup(Unknown Source)
               at org.jboss.seam.Component.instantiateSessionBean(Component.java:1357)
               at org.jboss.seam.Component.instantiate(Component.java:1321)
               at org.jboss.seam.Component.newInstance(Component.java:2074)
               ... 53 more



          • 2. Re: Seam Remoting Newbie Question--Getting Exception
            Greg Zoller Newbie

            For the sake of anyone finding this post looking for a solution to the same problem--here's the answer.


            The answer is:  Seam Remoting appears to require EJB functionality on some level.  If you package your project as a war file Seam remoting will not work, at least out of the box as advertised in the docs.  (Haven't checked yet to see if there is a work-around, but at this point I'm assuming not.)


            I generated identical projects, one as an ear and another as a war and the war version blew up with the exception above.  The ear worked wonderfully just as advertised.


            Greg

            • 3. Re: Seam Remoting Newbie Question--Getting Exception
              judy guglielmin Novice

              Not true.  I managed to get a war deployment (but was using ICEfaces). I just took the original chat-remoting example and made an ear out of it.

              • 4. Re: Seam Remoting Newbie Question--Getting Exception
                judy guglielmin Novice

                sorry...I meant that I took the ear example of remoting chat and made a war deployment out of it.

                • 5. Re: Seam Remoting Newbie Question--Getting Exception
                  Greg Zoller Newbie

                  How did you make a war out of the ear?


                  Thanks!