7 Replies Latest reply on Aug 1, 2006 1:10 PM by gavin.king

    Seam component instantiation problem

    bluetrade

      Hi,
      I have a stateless seam component, that I use for my RMI stuff. Unlike my other components it doesn't seem to be instantiated, the entityManager (even though it contains @In(create=true)) is null, when I do a invocation from the client...

      This component is the only component that is not mentioned anywhere inside my View, since it is pure RMI, I think that is the problem, so how could I "properly" instantiate it? Any clues?

      Thanks

        • 1. Re: Seam component instantiation problem
          gavin.king

          Is it in the same ejb-jar as the rest of the components?

          • 2. Re: Seam component instantiation problem

            Hi,

            I am also having an issue with the Instantiation of the Seam Component..

            I am trying the HelloWorld App in examples/remoting..

            In the JBoss Server log i see the component..

            
            13:43:42,828 INFO [Scanner] scanning: /D:/Projects/DPA/Jboss4.0.4/server/default/tmp/deploy/tmp43419MySeamTest.ear-cont
            ents/MySeamTest-ejb.jar
            13:43:42,828 INFO [Component] Component: helloAction, scope: STATELESS, type: STATELESS_SESSION_BEAN, class: org.jboss.
            seam.example.remoting.HelloAction, JNDI: MySeamTest-war/HelloAction/local
            13:43:42,984 INFO [Initialization] done initializing Seam
            
            


            Note: i have created an EAR App (MySeamtest) in NetBeans and hence the name MySeamTest.ear..

            And when i run the App it is accepting the User Name and the throwing the following Exception..



            13:43:58,429 ERROR [ExecutionHandler] Error during remote request
            org.jboss.seam.InstantiationException: Could not instantiate Seam component: helloAction
             at org.jboss.seam.Component.newInstance(Component.java:735)
             at org.jboss.seam.Component.newInstance(Component.java:1308)
             at org.jboss.seam.Component.getInstance(Component.java:1263)
             at org.jboss.seam.Component.getInstance(Component.java:1246)
             at org.jboss.seam.remoting.Call.execute(Call.java:101)
             at org.jboss.seam.remoting.ExecutionHandler.handle(ExecutionHandler.java:92)
             at org.jboss.seam.remoting.SeamRemotingServlet.doPost(SeamRemotingServlet.java:56)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
             at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java
            :664)
             at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
             at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
             at java.lang.Thread.run(Thread.java:595)
            Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.LocalOnlyContextFactory
            [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.LocalOnlyContextFactory]
             at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
             at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
             at javax.naming.InitialContext.init(InitialContext.java:223)
             at javax.naming.InitialContext.<init>(InitialContext.java:197)
             at org.jboss.seam.util.Naming.getInitialContext(Naming.java:28)
             at org.jboss.seam.util.Naming.getInitialContext(Naming.java:37)
             at org.jboss.seam.Component.instantiate(Component.java:774)
             at org.jboss.seam.Component.newInstance(Component.java:731)
             ... 26 more
            Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.LocalOnlyContextFactory
             at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1352)
             at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
             at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
             at java.lang.Class.forName0(Native Method)
             at java.lang.Class.forName(Class.java:242)
             at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
             at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
             ... 33 more
            


            And in the Debug window i see this output
            Mon Jul 31 2006 13:51:35 GMT-0400 (Eastern Daylight Time): Request packet:
            <envelope><header><context></context></header><body><call component="helloAction" method="sayHello" id="1">
            <params><param><str>sdsdf</str></param></params><refs></refs></call></body></envelope>
            
            
            Mon Jul 31 2006 13:51:35 GMT-0400 (Eastern Daylight Time): Response packet:
            


            I have added the following context parameter to web.xml

             <context-param>
             <param-name>org.jboss.seam.core.init.jndiPattern</param-name>
             <param-value>MySeamTest-war/#{ejbName}/local </param-value>
             </context-param>
            


            Thanks
            Sateesh

            • 3. Re: Seam component instantiation problem

              Hi,

              It seems the name should be MySeamTest/HelloAction/local instead of MySeamTest-war/HelloAction/local .

              I made the change and still getting the error..!!



              "klsateesh" wrote:
              Hi,

              I am also having an issue with the Instantiation of the Seam Component..

              I am trying the HelloWorld App in examples/remoting..

              In the JBoss Server log i see the component..

              
              13:43:42,828 INFO [Scanner] scanning: /D:/Projects/DPA/Jboss4.0.4/server/default/tmp/deploy/tmp43419MySeamTest.ear-cont
              ents/MySeamTest-ejb.jar
              13:43:42,828 INFO [Component] Component: helloAction, scope: STATELESS, type: STATELESS_SESSION_BEAN, class: org.jboss.
              seam.example.remoting.HelloAction, JNDI: MySeamTest-war/HelloAction/local
              13:43:42,984 INFO [Initialization] done initializing Seam
              
              


              Note: i have created an EAR App (MySeamtest) in NetBeans and hence the name MySeamTest.ear..

              And when i run the App it is accepting the User Name and the throwing the following Exception..



              13:43:58,429 ERROR [ExecutionHandler] Error during remote request
              org.jboss.seam.InstantiationException: Could not instantiate Seam component: helloAction
               at org.jboss.seam.Component.newInstance(Component.java:735)
               at org.jboss.seam.Component.newInstance(Component.java:1308)
               at org.jboss.seam.Component.getInstance(Component.java:1263)
               at org.jboss.seam.Component.getInstance(Component.java:1246)
               at org.jboss.seam.remoting.Call.execute(Call.java:101)
               at org.jboss.seam.remoting.ExecutionHandler.handle(ExecutionHandler.java:92)
               at org.jboss.seam.remoting.SeamRemotingServlet.doPost(SeamRemotingServlet.java:56)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
               at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java
              :664)
               at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
               at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
               at java.lang.Thread.run(Thread.java:595)
              Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.LocalOnlyContextFactory
              [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.LocalOnlyContextFactory]
               at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
               at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
               at javax.naming.InitialContext.init(InitialContext.java:223)
               at javax.naming.InitialContext.<init>(InitialContext.java:197)
               at org.jboss.seam.util.Naming.getInitialContext(Naming.java:28)
               at org.jboss.seam.util.Naming.getInitialContext(Naming.java:37)
               at org.jboss.seam.Component.instantiate(Component.java:774)
               at org.jboss.seam.Component.newInstance(Component.java:731)
               ... 26 more
              Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.LocalOnlyContextFactory
               at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1352)
               at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
               at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
               at java.lang.Class.forName0(Native Method)
               at java.lang.Class.forName(Class.java:242)
               at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
               at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
               ... 33 more
              


              And in the Debug window i see this output
              Mon Jul 31 2006 13:51:35 GMT-0400 (Eastern Daylight Time): Request packet:
              <envelope><header><context></context></header><body><call component="helloAction" method="sayHello" id="1">
              <params><param><str>sdsdf</str></param></params><refs></refs></call></body></envelope>
              
              
              Mon Jul 31 2006 13:51:35 GMT-0400 (Eastern Daylight Time): Response packet:
              


              I have added the following context parameter to web.xml

               <context-param>
               <param-name>org.jboss.seam.core.init.jndiPattern</param-name>
               <param-value>MySeamTest-war/#{ejbName}/local </param-value>
               </context-param>
              


              Thanks
              Sateesh


              • 4. Re: Seam component instantiation problem

                Hi All,

                I Checked the JNDI MBean View and i see an entry for Hello Action..

                
                Global JNDI Namespace
                
                 +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
                 +- MySeamTest (class: org.jnp.interfaces.NamingContext)
                 | +- HelloAction (class: org.jnp.interfaces.NamingContext)
                 | | +- local (proxy: $Proxy182 implements interface org.jboss.seam.example.remoting.HelloLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
                 +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
                


                pls let me know how to resolve this..

                Thanks
                Sateesh

                • 5. Re: Seam component instantiation problem
                  gavin.king

                  You don't have the JBoss JNDI implementation in your classpath.

                  • 6. Re: Seam component instantiation problem

                    Hi Gavin,

                    Thanks for your reply..

                    I have included the jboss-ejb3-all.jar in the CLASSPATH and when i try to run the example i am getting the below Exception.

                    I have searched the forum for this and it seems a ClassLoading Issue and a JBoss bug .Not sure whether it is resolved or not..Could u pls let us know..

                    
                    10:31:24,805 ERROR [ExecutionHandler] Error during remote request
                    java.lang.IllegalArgumentException: value found for In attribute has the wrong type: helloAction
                     at org.jboss.seam.Component.getInstance(Component.java:1273)
                     at org.jboss.seam.Component.getInstance(Component.java:1246)
                     at org.jboss.seam.remoting.Call.execute(Call.java:101)
                     at org.jboss.seam.remoting.ExecutionHandler.handle(ExecutionHandler.java:92)
                     at org.jboss.seam.remoting.SeamRemotingServlet.doPost(SeamRemotingServlet.java:56)
                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                     at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                     at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java
                    :664)
                     at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                     at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                     at java.lang.Thread.run(Thread.java:595)
                    


                    Thanks
                    Sateesh

                    • 7. Re: Seam component instantiation problem
                      gavin.king

                      Use your debugger to resolve the problem. I very much doubt that this is due to any bug in JBoss.