3 Replies Latest reply on Jan 22, 2009 3:36 PM by luxspes

    SeamAction: Could not instantiate Seam component. NEED HELP

    mpssantos.mpssantos.gmail.com

      I just build a JBoss Seam project with Eclipse 3.4 Ganymed. I used the JBoss Tools, and i choosed the war file for the deployment because i intent to use a Tomcat server, but rigth now im using JBoss AS 3.2.4. I created the seam project with the wizard, and then i created the Ping Action like the chapter 3 of the reference book say so. It work perfectly. But i would like to use the action to persist an object on the database. So i added the follow annotation so i can use the EntityManager:



      @Stateless

      @Name("ping")

      public class Ping implements IPing { .... }

      when i execute the action by pressing the button ping i get this exception.




      23:21:31,545 WARN  [lifecycle] Could not instantiate Seam component: ping
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: ping

              at org.jboss.seam.Component.newInstance(Component.java:2106)
              at org.jboss.seam.Component.getInstance(Component.java:1988)
              at org.jboss.seam.Component.getInstance(Component.java:1950)
              at org.jboss.seam.Component.getInstance(Component.java:1944)
              at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
              at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
              at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
              at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
              at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
              at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
              at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
              at org.jboss.el.parser.AstValue.getTarget(AstValue.java:34)
              at org.jboss.el.parser.AstValue.invoke(AstValue.java:95)
              at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
              at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
              at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
              at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
              at javax.faces.component.UICommand.broadcast(UICommand.java:387)
              at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
              at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
              at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
              at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
              at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
              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:40)
              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.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
              at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
              at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
              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.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
              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:182)
              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: javax.naming.NameNotFoundException: Ping 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:1367)
              at org.jboss.seam.Component.instantiate(Component.java:1331)
              at org.jboss.seam.Component.newInstance(Component.java:2084)
              ... 66 more

      Can any one explain me what am i missing!


      Thanks a lot.


      Bests Regards / Os meus melhores cumprimentos


      Marco Santos, a seam newbie

        • 1. Re: SeamAction: Could not instantiate Seam component. NEED HELP

          @Stateless is for EJBs not for POJOs, and therefore you project would have to be EAR, not WAR. Or just do not use @Stateless use @Scope(ScopeType.STATELESS) and keep using POJOs.


          Are you sure you are using JBoss AS 3.2.4? maybe you wanted to write JBoss AS 4.2.3? (I am not sure if Seam works with Jboss 3.x)


          Regards,

          • 2. Re: SeamAction: Could not instantiate Seam component. NEED HELP
            mpssantos.mpssantos.gmail.com

            Thanx a lot!!


            Yes i am using JBoss AS 4.2.3!


            Why WAR does not support EJB's? What will i be missing using just Pojos instead EJB's?


            To use



            @PersistenceContext private EntityManager em;

            i need a session bean or message driven bean components. How can i get arround this problem? I need the EntityManager to persiste the Entity, but on other way i need the WAR because in future this application needs to run with another that is already running on a Tomcat server.!


            Once again, thanks a lot


            Muito Obrigado!


            Marco Santos


            • 3. Re: SeamAction: Could not instantiate Seam component. NEED HELP

              Marco Santos wrote on Jan 22, 2009 03:50:


              Thanx a lot!!

              Yes i am using JBoss AS 4.2.3!

              Why WAR does not support EJB's? What will i be missing using just Pojos instead EJB's?



              You can read about the difference between POJOs and EJBs in this thread.



              To use

              @PersistenceContext private EntityManager em;

              i need a session bean or message driven bean components. How can i get arround this problem?



              Yes, you need that for @PersistenceContext, but you can inject the Entitymanager using @In and that way you do not need session bean or message driven bean components, plain POJOs are enough.



              I need the EntityManager to persiste the Entity, but on other way i need the WAR because in future this application needs to run with another that is already running on a Tomcat server.!



              Again @In can inject EntityManager, you do not need @PersistenceContext.



              Once again, thanks a lot

              Muito Obrigado!

              Marco Santos




              I really recommend to read the book Seam in Action it will save you lots of headaches.