5 Replies Latest reply on Oct 11, 2006 9:08 AM by mnrz

    is there a complete reference to configure Tomcat for a Seam

    mnrz

      Hi

      is there any one did it before. I want to configure my seam project to work with Tomcat. connecting to database and all config files needed for Seam.
      if anyone has some sample config file would you please display it for me.

      any help will be appreciated.

        • 1. Re: is there a complete reference to configure Tomcat for a
          baz

          Hello,
          We are using seam with tomcat.
          Seams comes with great documentation for its configuration.
          Please read this: http://docs.jboss.com/seam/latest/reference/en/html/configuration.html.
          You can use the embeddable EJB3 container http://docs.jboss.com/seam/latest/reference/en/html/configuration.html#d0e4780
          or try to run hibernate in the jboss microcontainer http://docs.jboss.com/seam/latest/reference/en/html/configuration.html#d0e5061.

          All of the examples for seam can be run with embeddable ejb. Therfore they provide a great resource for example config files.

          There is one example that shows how to run with hibernate in the microcontainer. It is called hibernate:-) We have used this example as a starting point.
          Hope this helps for the moment.
          When you have more specific questions about setting up seam with tomcat please ask them here.
          Ciao,
          Carsten

          • 2. Re: is there a complete reference to configure Tomcat for a
            mnrz

            Thank you very much indeed for your useful links and comments.
            but I still have problem and I think easily will resolve

            my application war file structure is the same has been told in that document. but I have problem connection database, here is my persistence.xml and jboss-beans.xml files:

            persistence.xml

            <persistence>
             <persistence-unit name="testDatabase">
             <provider>org.hibernate.ejb.HibernatePersistence</provider>
             <jta-data-source>testDatasource</jta-data-source>
             <properties>
             <property name="hibernate.hbm2ddl.auto" value="create-drop" />
             <property name="hibernate.show_sql" value="true" />
             <!-- These are the default for JBoss EJB3, but not for HEM: -->
             <property name="hibernate.cache.provider_class"
             value="org.hibernate.cache.HashtableCacheProvider" />
             <property name="hibernate.transaction.manager_lookup_class"
             value="org.hibernate.transaction.JBossTransactionManagerLookup" />
             <property name="hibernate.dialect"
             value="org.hibernate.dialect.MySQLDialect" />
             </properties>
             </persistence-unit>
            </persistence>
            
            


            and jboss-beans.xml:
            <?xml version="1.0" encoding="UTF-8"?>
            
            <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
             xmlns="urn:jboss:bean-deployer">
            
             <bean name="testDatasourceBootstrap"
             class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
             <property name="driverClass">com.mysql.jdbc.Driver</property>
             <property name="connectionURL">
             jdbc:mysql://localhost:3306/seamtest?autoReconnect=true&amp;
             useUnicode=true&amp;characterEncoding=UTF8
             </property>
             <property name="userName">root</property>
             <property name="password">root</property>
             <property name="jndiName">java:/testDatasource</property>
             <property name="minSize">0</property>
             <property name="maxSize">10</property>
             <property name="blockingTimeout">1000</property>
             <property name="idleTimeout">100000</property>
             <property name="transactionManager">
             <inject bean="TransactionManager" />
             </property>
             <property name="cachedConnectionManager">
             <inject bean="CachedConnectionManager" />
             </property>
             <property name="initialContextProperties">
             <inject bean="InitialContextProperties" />
             </property>
             </bean>
            
             <bean name="testDatasource" class="java.lang.Object">
             <constructor factoryMethod="getDatasource">
             <factory bean="testDatasourceBootstrap" />
             </constructor>
             </bean>
            
            </deployment>
            


            while Tomcat stating up when it's going to stating embedded Ejb an exception throws with following message, I have doubt in in jboss-beans.xml file. I dont know what it is.

            (core.Ejb 94 ) starting the embedded EJB container
            (xml.BeanSchemaBinding 227 ) You should use the 2.0 version of the Microcontainer xml. xmlns='ur
            n:jboss:bean-deployer:2.0'
            (local.LocalTxDataSource 117 ) Bound datasource to JNDI name 'java:/DefaultDS'
            (local.LocalTxDataSource 117 ) Bound datasource to JNDI name 'java:/testDatasource'
            (ejb3.Ejb3Deployment 467 ) EJB3 deployment time took: 1047
            (ejb3.MCKernelAbstraction 84 ) installing bean: persistence.units:jar=registration-web.jar,unitNam
            e=testDatabase with dependencies:
            (ejb3.MCKernelAbstraction 87 ) AbstractDependencyMetaData@893a4a{dependency=testDatasource}
            (dependency.AbstractKernelController 350 ) Error installing to Start: name=persistence.units:jar=registration-
            web.jar,unitName=testDatabase state=Create
            javax.naming.NameNotFoundException: testDatasource 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:296)
             at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:626)
             at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:588)
             at javax.naming.InitialContext.lookup(InitialContext.java:351)
             at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:240)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:585)
             at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55)
             at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:107
            )
             at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
             at org.jboss.kernel.plugins.dependency.KernelControllerContextActions.dispatchJoinPoint(KernelControll
            erContextActions.java:100)
             at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$LifecycleAction.installAction(Ke
            rnelControllerContextActions.java:582)
             at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$KernelControllerContextAction.in
            stall(KernelControllerContextActions.java:175)
             at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActi
            ons.java:51)
             at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:593)
             at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:346)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:438)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:379)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:225)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:151)
             at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:
            79)
             at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:
            73)
             at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:91)
             at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:626)
             at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:475)
             at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.start(EJB3StandaloneDeployer.java:460)
             at org.jboss.seam.core.Ejb.startup(Ejb.java:50)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:585)
             at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
             at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
             at org.jboss.seam.Component.callComponentMethod(Component.java:1334)
             at org.jboss.seam.Component.callCreateMethod(Component.java:1322)
             at org.jboss.seam.Component.newInstance(Component.java:1312)
             at org.jboss.seam.Component.getInstance(Component.java:1263)
             at org.jboss.seam.Component.getInstance(Component.java:1253)
             at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:125)
             at org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:104)
             at org.jboss.seam.init.Initialization.init(Initialization.java:196)
             at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:32)
             at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3669)
             at org.apache.catalina.core.StandardContext.start(StandardContext.java:4104)
             at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
             at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
             at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
             at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:589)
             at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:536)
             at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:471)
             at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102)
             at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
             at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
             at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
             at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
             at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
             at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
             at org.apache.catalina.core.StandardService.start(StandardService.java:450)
             at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
             at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:585)
             at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
             at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
            (ejb3.MCKernelAbstraction 84 ) installing bean: jboss.j2ee:jar=registration-web,name=RegisterActio
            n,service=EJB3 with dependencies:
            (ejb3.MCKernelAbstraction 87 ) AbstractDependencyMetaData@94d313{dependency=persistence.units
            :jar=registration-web.jar,unitName=testDatabase}
            



            Thank you so much again

            • 3. Re: is there a complete reference to configure Tomcat for a
              baz

              Hello,
              i think your problem has nothing to do with seam running on tomcat.
              If i am not completly misleaded your problem is with the jndi name of the datasource.
              Instead of

              <jta-data-source>testDatasource</jta-data-source>

              try
              <jta-data-source>java:/testDatasource</jta-data-source>

              If this doesn't help i am out of clues. Perhaps someone other can help, then.
              Ciao,
              Carsten

              • 4. Re: is there a complete reference to configure Tomcat for a
                baz

                one sentence more:
                the property jndiName from jboss-beans.xml must match jta-data-source from persistence.xml
                In your case
                jndiName = java:/testDatasource
                and
                jta-data-source =testDatasource
                Ciao,
                Carsten

                • 5. Re: is there a complete reference to configure Tomcat for a
                  mnrz

                  Hi again

                  thank you so much, your comments help me so much. yes, you were right the problem was because of not matching the jndiName and jta-data-source.

                  and another mistake was that because I am using Mysql and Jdbc I should use jdbc:/testDatasource instead of java:/testDatasource.

                  any way, thank you for spending your time to reply me.