1 2 Previous Next 17 Replies Latest reply on Dec 7, 2005 5:20 AM by Matthew Edwards

    SEAM Embedded EJB Tomcat 5.5

    Manuel Gentile Newbie

      Hi,

      I'm trying to deploy the embeddable ejb and JBoss Seam on tomcat 5.5.

      I add

      <listener-class>org.jboss.ejb3.embedded.ServletBootstrapListener</listener-class>


      in web.xml

      and this is my seam.properties

      #org.jboss.seam.core.init.componentClasses org.jboss.seam.core.Ejb
      org.jboss.seam.core.init.componentClasses = org.jboss.seam.core.Microcontainer
      # Seam manages a Hibernate Session (set PhaseListener in faces-config.xml for strategy)
      org.jboss.seam.init.managedPersistenceContexts = bookingDatabase
      #bookingDatabase.persistenceUnitName = java:/EntityManagerFactories/bookingData
      # Conversation timeout (in milliseconds)
      org.jboss.seam.core.manager.conversationTimeout = 120000
      # Store Conversation state in serialized form on the client (needs bugfix in Hibernate)
      #org.jboss.seam.core.init.clientSideConversations = true
      # Seam bootstraps the JBoss Microcontainer
      #org.jboss.seam.core.init.componentClasses = org.jboss.seam.core.Microcontainer
      # JNDI settings to access the JBoss Microcontainer registry
      seam.jndi.java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      seam.jndi.java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

      but i have this error

      Caused by: javax.naming.NameNotFoundException: ....Login not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:516)

      ...
      Can we have a complete example of use Embeddable EJB , Seam on Tomcat 5.5?

      Thanks

        • 1. Re: SEAM Embedded EJB Tomcat 5.5
          Andrew Atkinson Newbie

          checkout jboss-seam-head from :pserver:anonymous@anoncvs.forge.jboss.com:/cvsroot/jboss

          examples/noejb has a working deployable-to-tomcat example. Be sure to use the build.tomcat.xml buildfile.

          • 2. Re: SEAM Embedded EJB Tomcat 5.5
            Manuel Gentile Newbie

            I have problem with Embeddable EJB on tomcat, and no problem with noejb version. I want to use Seam Application with EJB on Tomcat 5.5.
            Any solution?

            • 3. Re: SEAM Embedded EJB Tomcat 5.5
              Thomas Heute Master

              Do you have:

              <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>


              in web.xml ?

              • 4. Re: SEAM Embedded EJB Tomcat 5.5
                Marius Oancea Novice

                IMHO is not possible to use EJB simply on Tomcat 5.5 because tomcat is not a real enterprise container. Either use seam without EJB (as in noejb) either install jboss

                • 5. Re: SEAM Embedded EJB Tomcat 5.5
                  Gavin King Master

                  It is a little bit tricky to configure Embeddable EJB3 on Tomcat because of Tomcat's readonly JNDI. However, Thomas did get it working and we will try to have an example app for this ASAP.

                  It might slip from the December release however, simply due to the other work we need to get finished.

                  • 6. Re: SEAM Embedded EJB Tomcat 5.5
                    Christian Bauer Master

                    It's actually quite straightforward. Replace the /noejb/ configuration files and libraries with the embeddable EJB 3.0 container configuration and libraries. Tomcat JNDI doesn't have to be touched at all, the webapp has its own JNDI context (jndi.properties). You can deploy the TestNG example I wrote about here in Tomcat with a few tweaks, and then run Seam stuff on it: http://blog.hibernate.org/cgi-bin/blosxom.cgi/2005/11/24#ejb3withtestng

                    • 7. Re: SEAM Embedded EJB Tomcat 5.5
                      Matthew Edwards Newbie

                      I have setup JSF MyFaces, EJB3, Seam and Tomcat 5.5. It is almost working. I think that I have everything working except the EJB3.

                      When my application goes to look up something within my EJB3 jar, I get the following error:

                      ERROR 02-12 03:56:25,421 (SeamExceptionFilter.java:doFilter:43) -uncaught exception handled by Seam: Could not start transaction
                      ERROR 02-12 03:56:25,421 (SeamExceptionFilter.java:rollbackAfterException:78) -could not roll back transaction
                      javax.naming.NamingException: Cannot create resource instance
                      at org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:98)
                      at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
                      at org.apache.naming.NamingContext.lookup(NamingContext.java:792)
                      at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
                      at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
                      at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
                      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)
                      at javax.naming.InitialContext.lookup(Unknown Source)
                      at org.jboss.seam.util.Transactions.getUserTransaction(Transactions.java:40)
                      at org.jboss.seam.util.Transactions.isTransactionActiveOrMarkedRollback(Transactions.java:33)
                      at org.jboss.seam.servlet.SeamExceptionFilter.rollbackAfterException(SeamExceptionFilter.java:70)
                      at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:44)
                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                      at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
                      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.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:868)
                      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
                      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
                      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
                      at java.lang.Thread.run(Unknown Source)
                      ERROR 02-12 03:56:25,421 (StandardWrapperValve.java:invoke:260) -Servlet.service() for servlet Faces Servlet threw exception
                      java.lang.RuntimeException: Uncaught Exception
                      at org.jboss.seam.servlet.SeamExceptionFilter.endWebRequestAfterException(SeamExceptionFilter.java:52)
                      at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                      at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
                      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.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:868)
                      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
                      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
                      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
                      at java.lang.Thread.run(Unknown Source)


                      Can anyone tell me what could be causing this error?

                      Cheers.

                      • 8. Re: SEAM Embedded EJB Tomcat 5.5
                        Gavin King Master

                        Looks like a JNDI issue. You need to be doing the lookup for the UT using JBoss JNDI provider, not the Tomcat built-in JNDI.

                        • 9. Re: SEAM Embedded EJB Tomcat 5.5
                          Matthew Edwards Newbie

                          I haven't been able to figure out how to do the "lookup for the UT using JBoss JNDI provider." Do I need to put it into my Java classes, or do I need a jndi.properties file?

                          If it is the latter (jndi.properties) could someone give me a hint about what should go in that file and where I should place that file?

                          again, cheers.

                          • 10. Re: SEAM Embedded EJB Tomcat 5.5
                            Thomas Heute Master

                            Add this to your seam.properties files:

                            # JNDI settings to access the JBoss Microcontainer registry
                            seam.jndi.java.naming.factory.initial = org.jnp.interfaces.NamingContextFactory
                            seam.jndi.java.naming.factory.url.pkgs = org.jboss.naming:org.jnp.interfaces
                            


                            • 11. Re: SEAM Embedded EJB Tomcat 5.5
                              Matthew Edwards Newbie

                              Now I am getting this error:

                              ERROR 05-12 06:18:09,140 (StandardWrapperValve.java:invoke:253) -Servlet.service() for servlet Faces Servlet threw exception
                              java.lang.NullPointerException
                               at org.apache.myfaces.context.servlet.ApplicationMap.getAttribute(ApplicationMap.java:41)
                               at org.apache.myfaces.context.servlet.AbstractAttributeMap.get(AbstractAttributeMap.java:87)
                               at org.jboss.seam.contexts.WebApplicationContext.get(WebApplicationContext.java:46)
                               at org.jboss.seam.contexts.Contexts.lookupInStatefulContexts(Contexts.java:146)
                               at org.jboss.seam.Component.getInstance(Component.java:845)
                               at org.jboss.seam.Component.forName(Component.java:835)
                               at org.jboss.seam.Component.getInstance(Component.java:856)
                               at org.jboss.seam.core.Manager.instance(Manager.java:230)
                               at org.jboss.seam.jsf.SeamPhaseListener.restoreAnyConversationContext(SeamPhaseListener.java:88)
                               at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:77)
                               at org.apache.myfaces.lifecycle.LifecycleImpl.informPhaseListenersAfter(LifecycleImpl.java:536)
                               at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:164)
                               at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
                               at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                               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.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:868)
                               at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
                               at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                               at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
                               at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
                               at java.lang.Thread.run(Unknown Source)
                              




                              Do I need these properties in my seam.properties file also:

                              org.jboss.seam.init.componentClasses org.jboss.seam.core.Ejb
                              
                              org.jboss.seam.init.managedPersistenceContexts defaultDatabase
                              defaultDatabase.persistenceUnitName java:/EntityManagerFactories/DefaultEntityManager
                              



                              When I start Tomcat I get the following line in the log file:

                              INFO 05-12 06:17:24,781 (SessionFactoryObjectFactory.java:addInstance:82) -Not binding factory to JNDI, no JNDI name configured
                              



                              Thanks for your help.

                              • 12. Re: SEAM Embedded EJB Tomcat 5.5
                                Matthew Edwards Newbie

                                I have been fiddeling with this Tomcat - Seam - EJB - Facelets/JSF configuration all weekend and I still can't get it right. I have another error that I don't understand, but I think this one is probrably an easy one (Ik heb niet voor een paar dagen geslapen.)

                                ERROR 05-12 13:53:18,325 (StandardWrapperValve.java:invoke:253) -Servlet.service() for servlet Faces Servlet threw exception
                                java.lang.IllegalStateException: getAttribute: Session already invalidated
                                 at org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1009)
                                 at org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:109)
                                 at org.jboss.seam.servlet.ServletSessionImpl.getAttribute(ServletSessionImpl.java:34)
                                 at org.jboss.seam.contexts.ConversationContext.get(ConversationContext.java:58)
                                 at org.jboss.seam.contexts.Contexts.lookupInStatefulContexts(Contexts.java:116)
                                 at org.jboss.seam.Component.getInstance(Component.java:845)
                                 at org.jboss.seam.Component.forName(Component.java:835)
                                 at org.jboss.seam.Component.getInstance(Component.java:856)
                                 at org.jboss.seam.core.Manager.instance(Manager.java:230)
                                 at org.jboss.seam.jsf.SeamPhaseListener.restoreAnyConversationContext(SeamPhaseListener.java:88)
                                 at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:77)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.informPhaseListenersAfter(LifecycleImpl.java:536)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:164)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
                                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
                                 at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
                                 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.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:868)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
                                 at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
                                 at java.lang.Thread.run(Unknown Source)
                                


                                Could someone help me on this one?

                                I am trying to put together a manuel about setting up Seam projects on the JBoss server and the Tomcat server. It is for an english term project I need to do. I have most if it written---just not the tomcat part of it. I have about 2 more days to finish. Any information on Tomcat setup would be awesome.

                                • 13. Re: SEAM Embedded EJB Tomcat 5.5
                                  Scott Stark Master

                                  You need to track down why the session has been invalidated and subsequently used. An invalidated session is completely unsuable so all references to it need to be cleared before its invalidated.

                                  • 14. Re: SEAM Embedded EJB Tomcat 5.5
                                    Gavin King Master

                                    This exception would usually occur because the session has been invalidated by calling HttpSession.invalidate() instead of Seam.invalidateSession(). You should not call HttpSession.invalidate() directly when using Seam.

                                    1 2 Previous Next