10 Replies Latest reply on Mar 19, 2007 5:16 PM by lle

    Issue with Seam and Tomcat 6 during tomcat startup

    lle

      Hi all,

      I just upgraded my working webapps with Seam 1.1.5GA from Tomcat 5.5 to Tomcat 6 and I encountered this problem when starting up Tomcat 6:

      After initializing Seam successfully, Seam starts to undeploying/destroying application context and eventually closing the Hibernate session factory. So, my application can't be used at all.

      Here is the stacktrace starting from successful Seam initialization:

      2007.03.09 12:04:47,888 INFO [Initialization] done initializing Seam
      2007.03.09 12:04:47,903 DEBUG [Lifecycle] Undeploying, destroying application context
      2007.03.09 12:04:47,903 DEBUG [Events] Processing event:org.jboss.seam.preDestroyContext.APPLICATION
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.safeActions.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.microcontainer.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: appManager
      2007.03.09 12:04:47,903 DEBUG [Events] Processing event:org.jboss.seam.preDestroy.appManager
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.conversationContext.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: user.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.framework.currentDate.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.exceptions.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: account.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: detailsfilter.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: selectedAccount.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.events
      2007.03.09 12:04:47,903 DEBUG [Events] Processing event:org.jboss.seam.preDestroy.org.jboss.seam.core.events
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: renderer.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.theme.themeSelector.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.localeSelector.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.httpError.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.conversation.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.facesPage.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.switcher.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.framework.currentTime.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.mail.mailSession.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: detailsearch.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.init.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.expressions.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.facesContext.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.conversationList.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.locale.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: hostApp.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.debug.introspector.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.isUserInRole.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.pageContext.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: reportfilter.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: hibernateSessionFactory
      2007.03.09 12:04:47,903 DEBUG [Events] Processing event:org.jboss.seam.preDestroy.hibernateSessionFactory
      2007.03.09 12:04:47,903 INFO [SessionFactoryImpl] closing
      2007.03.09 12:04:47,903 INFO [SessionFactoryObjectFactory] Unbinding factory from JNDI name: java:/gadb
      2007.03.09 12:04:47,903 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
      2007.03.09 12:04:47,903 INFO [SessionFactoryObjectFactory] Unbound factory from JNDI name: java:/gadb
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.conversationEntries.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: documentStore.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.redirect.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: alertsTable.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.pojoCache.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.uiComponent.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.events.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.messages.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.apache.AnnotationProcessor
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.interpolator.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: accountfilter.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: sessionfilter.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: accountTable.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: alertsview.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: logout.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.apache.catalina.WELCOME_FILES
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: reportsview.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.sessionContext.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.facesMessages.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.manager.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: selectedSession.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.validation.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.validators.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: gadb.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.init
      2007.03.09 12:04:47,903 DEBUG [Events] Processing event:org.jboss.seam.preDestroy.org.jboss.seam.core.init
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.microcontainer
      2007.03.09 12:04:47,903 DEBUG [Events] Processing event:org.jboss.seam.preDestroy.org.jboss.seam.core.microcontainer
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.pages.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.methodContext.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.remoting.remotingConfig.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: accountsearch.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: selectedAlertSession.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.userPrincipal.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: reportsaction.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: login.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.debug.contexts.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.conversationStack.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.persistenceContexts.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.eventContext.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.resourceBundle.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.theme.theme.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.properties
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.framework.currentDatetime.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.apache.catalina.jsp_classpath
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: javax.servlet.context.tempdir
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: appManager.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.businessProcessContext.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.apache.catalina.resources
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: org.jboss.seam.core.applicationContext.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: hibernateSessionFactory.component
      2007.03.09 12:04:47,903 DEBUG [Contexts] destroying: alertssearch.component
      2007.03.09 12:04:47,903 DEBUG [Events] Processing event:org.jboss.seam.postDestroyContext.APPLICATION


      Does any of you know what's going on and why such an issue occurs? Btw, I do have an application-scoped component in case you wonder.

      Thanks
      ly

        • 1. Re: Issue with Seam and Tomcat 6 during tomcat startup
          mlh496

          I'm sorry that I can't help you with this problem. However, have you ever gotten a MySql-backed Seam app to work on Tomcat 5.5? I've been trying to do this for about 8 days now, and I'm uber-stuck.

          -Michael

          • 2. Re: Issue with Seam and Tomcat 6 during tomcat startup

            lle--

            This looks similar to a problem I was having once: I'd throw my war into Tomcat's webapps directory, start Tomcat, and it would start up then shut down, giving me log messages similar to what you pasted. Turns out it was because I had both Tomcat and some other process (JBoss, I think) fighting over something (ports? who knows). Make sure you don't have any "javaw.exe" processes running when you start Tomcat.

            My apologies if this isn't any help.

            --Rich

            • 3. Re: Issue with Seam and Tomcat 6 during tomcat startup

              MLH--

              I got Seam running on MySQL...what's the error you're getting?

              This site got me pretty far into the process:

              http://wiki.jboss.org/wiki/Wiki.jsp?page=SetUpAMysqlDatasource

              • 4. Re: Issue with Seam and Tomcat 6 during tomcat startup
                lle

                Thank you all for your responses.

                MLH: I did get Seam 1.1.5 working with Mysql and Tomcat 5.5. The site apushadow gave definitely can help you out. Please describe your errors/configuration so we can help.

                Rich: I don't have "javaw.exe" processes when I run tomcat and I still get the error. If I switch back to Tomcat 5, then it is ok. So it must be something between Seam and Tomcat 6. Did you get it working with Tomcat 6?

                Thanks.
                ly

                • 5. Re: Issue with Seam and Tomcat 6 during tomcat startup
                  mlh496

                  Hey there,

                  The problem I've hit deploying a Seam app to Tomcat deals with the datasource. Here is a sample of the error trail that I get:

                  16:27:52,083 ERROR [NamingHelper] Could not obtain initial context
                  javax.naming.NamingException: Local server is not initialized
                  16:27:52,098 FATAL [DatasourceConnectionProvider] Could not find datasource: java:/comp/env/omegaDatasource
                  javax.naming.NamingException: Local server is not initialized
                  16:27:52,098 ERROR [[/omega]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
                  javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not find datasource
                  Caused by: org.hibernate.HibernateException: Could not find datasource
                   at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
                  Caused by: javax.naming.NamingException: Local server is not initialized
                   at org.jnp.interfaces.LocalOnlyContextFactory.getInitialContext(LocalOnlyContextFactory.java:45)


                  Does this look familiar to the errors you encountered?

                  Thanks for the link; I'll give that a try.

                  -Michael

                  • 6. Re: Issue with Seam and Tomcat 6 during tomcat startup
                    lle

                    hi Michael,

                    Did you have your jndi configured correctly?

                    This is what I got in my log file of a successful Seam + Tomcat 5.5:

                    2007.03.09 14:29:08,808 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
                    2007.03.09 14:29:08,808 INFO [DatasourceConnectionProvider] Using datasource: java:/hibernateDatasource-mysql
                    2007.03.09 14:29:08,808 INFO [SettingsFactory] RDBMS: MySQL, version: 5.0.22-community-nt
                    2007.03.09 14:29:08,808 INFO [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.13 ( $Date: 2005-11-17 15:53:48 +0100 (Thu, 17 Nov 2005) $, $Revision$ )
                    2007.03.09 14:29:08,808 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
                    2007.03.09 14:29:08,824 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.transaction.JTATransactionFactory
                    2007.03.09 14:29:08,824 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
                    2007.03.09 14:29:08,824 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
                    2007.03.09 14:29:08,824 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
                    2007.03.09 14:29:08,824 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
                    2007.03.09 14:29:08,824 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup


                    From your exception, it seems that your JNDI doesn't get set up correctly.
                    You need to have the jndi.properties under your WEB-INF/lib directory. The file should contain these lines:
                    java.naming.factory.initial org.jnp.interfaces.LocalOnlyContextFactory
                    java.naming.factory.url.pkgs org.jboss.naming:org.jnp.interfaces


                    If that doesn't help, turn on your seam debug level and full debug log file.



                    • 7. Re: Issue with Seam and Tomcat 6 during tomcat startup

                      Michael--
                      Yeah, it looks like java:/comp/env/omegaDatasource isn't being found. I never use comp/env, though (I use java:/omegaDatasource)...not sure if that's your problem.


                      ly--
                      I have Tomcat 5.5 at work and 6.0 at home...I haven't tried having both on the same box (maybe Tomcat is fighting with itself...ports or Windows Services or something?). I had just emailed myself my code from work and deployed the same code base with no problems at home. Have you tried deploying a non-Seam app to your Tomcat 6 installation to make sure the installation works? By the way, I saw the log...what behavior are you getting when you deploy to Tomcat 6? Mine would start up, show the login page (without the stylesheet loaded...I use Firefox as a browser), and not let me log in because the contexts got dropped. The log looked similar to yours...of course, it may be a completely different problem and I might be just leading you down the Path of Wasted Time. :-/

                      I just tried installing 6.0 at work and the installation wizard won't properly install the Windows Service. *shrug* Sorry, man.

                      --Rich

                      • 8. Re: Issue with Seam and Tomcat 6 during tomcat startup
                        lle

                        Hi Rich,

                        I am very sure it is not an issue with port conflicts. I installed both versions of tomcat as standalone installation, not window services.
                        For the behavior, as soon as I started Tomcat, after Seam has finished successfully initializing my application, then it dropped the application context as shown in my previous log snippet. As a result, I couldn't even get to the log in page. I think the little difference of the time when the context is dropped between yours and mine might be due to my app has an app-scope component. Hence, the context was dropped as soon as it finished initialization. Does your app have any app-scope component? If not, then I think my theory is correct (i.e. your app drops the context after you get to the login page since it's after the context has been initialized, maybe???).
                        I did deploy a non-Seam webapp and it worked fine with Tomcat 6. I used the Tomahawk examples webapp, so it is also a JSF app.
                        It is definitely something to do with Seam and Tomcat 6. This line in the log file marked the begining of the context dropping:

                        2007.03.12 10:51:45,504 DEBUG [Lifecycle] Undeploying, destroying application context

                        Do you have something similar in your log file?

                        • 9. Re: Issue with Seam and Tomcat 6 during tomcat startup

                          Similar, but not the same:

                          11:00:08,843 INFO [Lifecycle] starting up: org.jboss.seam.remoting.remoting
                          11:00:08,843 INFO [Lifecycle] starting up: org.jboss.seam.servlet.exceptionFilter
                          11:00:08,843 INFO [Lifecycle] starting up: org.jboss.seam.captcha.captchaImage
                          11:00:09,421 INFO [Lifecycle] starting up: org.jboss.seam.servlet.multipartFilter
                          11:00:09,421 INFO [Lifecycle] starting up: org.jboss.seam.servlet.redirectFilter
                          11:00:09,421 INFO [Initialization] done initializing Seam
                          11:00:09,875 INFO [FacesConfigurator] Reading standard config org/apache/myfaces/resource/standard-faces-config.xml
                          11:00:10,375 INFO [FacesConfigurator] Reading config jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps/seam-helloworld/WEB-INF/lib/ajax4jsf.jar!/META-INF/faces-config.xml
                          11:00:10,390 INFO [FacesConfigurator] Reading config jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps/seam-helloworld/WEB-INF/lib/jboss-seam.jar!/META-INF/faces-config.xml
                          11:00:10,406 INFO [FacesConfigurator] Reading config jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps/seam-helloworld/WEB-INF/lib/jsf-facelets.jar!/META-INF/faces-config.xml
                          11:00:10,421 INFO [FacesConfigurator] Reading config /WEB-INF/faces-config.xml
                          11:00:10,640 WARN [LocaleUtils] Locale name in faces-config.xml null or empty, setting locale to default locale : en_US
                          11:00:11,343 INFO [StartupServletContextListener] ServletContext 'C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\seam-helloworld\' initialized.
                          11:00:11,343 INFO [StartupServletContextListener] Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
                          11:00:11,343 INFO [SeamFilter] Initializing filter: org.jboss.seam.servlet.multipartFilter
                          11:00:11,343 INFO [SeamFilter] Initializing filter: org.jboss.seam.servlet.exceptionFilter
                          11:00:11,343 INFO [SeamFilter] Initializing filter: org.jboss.seam.servlet.redirectFilter
                          11:00:11,937 INFO [ServletCacheAdministrator] Created new instance of ServletCacheAdministrator
                          11:00:11,937 INFO [ServletCacheAdministrator] Created new application-scoped cache at key: __oscache_cache
                          11:00:12,109 INFO [Lifecycle] starting up: org.jboss.seam.security.identity
                          11:00:12,218 INFO [Pages] reading pages.xml
                          11:00:14,937 INFO [Ejb] stopping the embedded EJB container
                          11:00:14,953 INFO [SessionFactoryImpl] closing
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@2aaec8
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1612600
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@153c9c7
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1281264
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1c57a92
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@9278d5
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@e7c832
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@11d00cf
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@13706e
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@3a5635
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@10ab3f2
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@c7816
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@1fe6783
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@f5bad0
                          Failed to initalize plugin: org.jboss.logging.Log4jLoggerPlugin@8d63cf
                          


                          My problem stopped when I found and stopped an extra "javaw.exe" process I had running.

                          Sorry I can't be of more help....at least this thread got a bump. :-)

                          --Rich

                          • 10. Re: Issue with Seam and Tomcat 6 during tomcat startup
                            lle

                            Thanks Rich,

                            According to your log snippet, you're using Tomcat 5.5 and not 6. I don't have any issues with Tomcat 5.5, only Tomcat 6.

                            Again, thanks for your response.
                            ly