1 2 Previous Next 23 Replies Latest reply on Oct 30, 2008 5:19 PM by Matt Nirgue

    seam TestNG does not work

    suzhen Li Newbie
      [Parser] Running:
        /home2/suzhen/workspace1/OAM2-test/test-src/org/domain/OAM2/test/LocalIpActionTest.xml

      FAILED CONFIGURATION: @BeforeClass init
      org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

      *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}

      persistence.units:unitName=OAMProject
      -> <UNKNOWN>{Described:** UNRESOLVED Demands 'jboss.jca:name=comp/env/jdbc/OAMProjectDB,service=DataSourceBinding **}


      *** CONTEXTS IN ERROR: Name -> Error

      <UNKNOWN> -> ** UNRESOLVED Demands 'jboss.jca:name=comp/env/jdbc/OAMProjectDB,service=DataSourceBinding **


           at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:576)
           at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:559)
           at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:128)
           at org.jboss.embedded.Bootstrap.deployResourceBases(Bootstrap.java:289)
           at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:15)
           at org.jboss.seam.mock.BaseSeamTest.startJbossEmbeddedIfNecessary(BaseSeamTest.java:1041)
           at org.jboss.seam.mock.BaseSeamTest.startSeam(BaseSeamTest.java:935)
           at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:923)
           at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
      ... Removed 22 stack frames
      SKIPPED CONFIGURATION: @BeforeMethod begin
      SKIPPED CONFIGURATION: @AfterMethod end
      SKIPPED CONFIGURATION: @AfterClass cleanup
      SKIPPED: test_applyChanges

      ===============================================
          LocalIpAction Test
          Tests run: 1, Failures: 0, Skips: 1
          Configuration Failures: 1, Skips: 3
      ===============================================


      ===============================================
      LocalIpAction Tests
      Total tests run: 1, Failures: 0, Skips: 1
      Configuration Failures: 1, Skips: 3
      ===============================================

        • 1. Re: seam TestNG does not work
          Matt Nirgue Newbie

          It seems that there's a problem with your persistence unit OAMProjectDB...


          Where and how did you define this persistence unit for your test? Is your datasource correctly configured (bootstrap/deploy/yourfile-ds.xml)?...


          Can you post your persistence.xml and your yourfile-ds.xml files please?


          • 2. Re: seam TestNG does not work
            suzhen Li Newbie
            When I created seam project, there are two folder are created, OAM and OAM-test.
            Here is persistence.xml from OAM:
            <?xml version="1.0" encoding="UTF-8"?>
            <!-- Persistence deployment descriptor for dev profile -->
            <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                         version="1.0">
                        
            <persistence-unit name="OAMProject" transaction-type="RESOURCE_LOCAL">
                  <provider>org.hibernate.ejb.HibernatePersistence</provider>
                  <jta-data-source>java:comp/env/jdbc/OAMProjectDB</jta-data-source>
                  <properties>
                     <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
                     <property name="hibernate.show_sql" value="true"/>
                     <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
                     <!-- RESOURCE_LOCAL-->
                       <!-- <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/> -->
                   
                     <!-- alternative
                     <property name="jboss.entity.manager.factory.jndi.name"
                          value="java:/jpaBookingEntityManagerFactory"/>
                     -->
                  </properties>
               </persistence-unit>
               
            </persistence>


            Here is oam-test-ds.xml from OAM-test

            <?xml version="1.0" encoding="UTF-8"?>

            <!DOCTYPE datasources
                PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
                "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">

            <datasources>

               <local-tx-datasource>
                  <jndi-name>OAMDatasource</jndi-name>
                  <connection-url>jdbc:postgresql://ip:port/databasename</connection-url>
                  <driver-class>org.postgresql.Driver</driver-class>
                  <user-name>username</user-name>
                  <password></password>
            <!--
                  <exception-sorter-class-name>
                     org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
                  </exception-sorter-class-name>
                  <metadata>
                     <type-mapping>mySQL</type-mapping>
                  </metadata>
            -->
               </local-tx-datasource>

            </datasources>


            Thanks a lot!
            • 3. Re: seam TestNG does not work
              Matt Nirgue Newbie
              You defined a RESOURCE_LOCAL persistence unit but you still want to use JTA? I don't think this is possible...
              do you NEED a RESOURCE_LOCAL for your tests? If you still want to use JTA, why don't you use something like that:

              <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                           xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                           version="1.0">
                 <persistence-unit name="OAMProject">
                    <provider>org.hibernate.ejb.HibernatePersistence</provider>
                    <jta-data-source>java:/OAMProjectDB</jta-data-source>
                    <properties>
                       <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
                       <property name="hibernate.show_sql" value="true"/>
                       <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="jboss.entity.manager.factory.jndi.name" value="java:/jpaBookingEntityManagerFactory"/>
                    </properties>
                 </persistence-unit>
              </persistence>

              I use JTA for my integration tests (using Embedded JBoss, TestNG, Maven, HSQLDB,...) and they work just fine...

              • 4. Re: seam TestNG does not work
                suzhen Li Newbie
                Hi Matt,

                If I changed the persistence.xml to your way, I can not load any pages.

                I just create a new project (OAMProject) with same name as persistence-unit using same persistence.xml. I got following error:

                *** CONTEXTS IN ERROR: Name -> Error

                vfsfile:/C:/Documents%20and%20Settings/suzhen/workspace1/OAMProject-test/bootstrap/deploy/messaging/jms-ds.xml -> java.lang.IllegalStateException: No ConnectorMetaData found for mdf rarName: jms-ra.rar

                jboss.jca:name=DefaultDS,service=DataSourceBinding -> ** NOT FOUND **

                vfsfile:/C:/Documents%20and%20Settings/suzhen/workspace1/OAMProject-test/bootstrap/deploy/jboss-local-jdbc.rar -> java.lang.NullPointerException

                vfsfile:/C:/Documents%20and%20Settings/suzhen/workspace1/OAMProject-test/bootstrap/deploy/jboss-xa-jdbc.rar -> java.lang.NullPointerException

                vfsfile:/C:/Documents%20and%20Settings/suzhen/workspace1/OAMProject-test/bootstrap/deploy/jms-ra.rar -> java.lang.NullPointerException

                vfsfile:/C:/Documents%20and%20Settings/suzhen/workspace1/OAMProject-test/bootstrap/deploy/hsqldb-ds.xml -> java.lang.IllegalStateException: No ConnectorMetaData found for mdf rarName: jboss-local-jdbc.rar


                     at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:576)
                     at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:559)
                     at org.jboss.embedded.Bootstrap.bootstrapURL(Bootstrap.java:149)
                     at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:183)
                     at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:195)
                     at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:11)
                     at org.jboss.seam.mock.BaseSeamTest.startJbossEmbeddedIfNecessary(BaseSeamTest.java:1041)
                     at org.jboss.seam.mock.BaseSeamTest.startSeam(BaseSeamTest.java:935)
                     at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:923)
                     at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
                ... Removed 22 stack frames
                SKIPPED CONFIGURATION: @BeforeMethod begin
                SKIPPED CONFIGURATION: @AfterMethod end
                SKIPPED CONFIGURATION: @AfterClass cleanup
                SKIPPED: test_apply


                I really, really need help!
                I stack on this a week.


                Thanks all you help!
                • 5. Re: seam TestNG does not work
                  Matt Nirgue Newbie
                  Even if you defined your datasource in your *-ds.xml, it's still looking for the default datasource... you need to add the hsqldb-ds.xml file (generated by seam-seam) in which the default datasource (DefaultDS) is defined...

                  Try adding this file in your classpath (bootstrap/deploy) and let me know what you get then...

                  ----------------------------------------- hsqldb-ds.xml ------------------------------------------------
                  <?xml version="1.0" encoding="UTF-8"?>

                  <!-- The Hypersonic embedded database JCA connection factory config -->

                  <!-- $Id: hsqldb-ds.xml 6916 2007-12-05 17:53:00Z pmuir $ -->

                  <datasources>
                     <local-tx-datasource>

                        <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
                        <!-- Datasources are not available outside the virtual machine -->
                        <jndi-name>DefaultDS</jndi-name>

                        <!-- For server mode db, allowing other processes to use hsqldb over tcp.
                        This requires the org.jboss.jdbc.HypersonicDatabase mbean.
                        <connection-url>jdbc:hsqldb:hsql://${jboss.bind.address}:1701</connection-url>
                        -->
                        <!-- For totally in-memory db, not saved when jboss stops.
                        The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
                        <connection-url>jdbc:hsqldb:.</connection-url>
                        -->
                        <!-- For in-process persistent db, saved when jboss stops.
                        The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
                        -->
                        <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>

                        <!-- The driver class -->
                        <driver-class>org.hsqldb.jdbcDriver</driver-class>

                        <!-- The login and password -->
                        <user-name>sa</user-name>
                        <password></password>

                        <!--example of how to specify class that determines if exception means connection should be destroyed-->
                        <!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name-->

                        <!-- this will be run before a managed connection is removed from the pool for use by a client-->
                        <!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> -->

                        <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
                        <min-pool-size>0</min-pool-size>

                        <!-- The maximum connections in a pool/sub-pool -->
                        <max-pool-size>20</max-pool-size>

                        <!-- The time before an unused connection is destroyed -->
                        <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
                        <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
                        <idle-timeout-minutes>0</idle-timeout-minutes>

                        <!-- sql to call when connection is created
                          <new-connection-sql>some arbitrary sql</new-connection-sql>
                        -->

                        <!-- sql to call on an existing pooled connection when it is obtained from pool
                           <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
                        -->

                        <!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool
                           <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name>
                        -->

                        <!-- Whether to check all statements are closed when the connection is returned to the pool,
                             this is a debugging feature that should be turned off in production -->
                        <track-statements/>

                        <!-- Use the getConnection(user, pw) for logins
                          <application-managed-security/>
                        -->

                        <!-- Use the security domain defined in conf/login-config.xml -->
                        <security-domain>HsqlDbRealm</security-domain>

                        <!-- Use the security domain defined in conf/login-config.xml or the
                             getConnection(user, pw) for logins. The security domain takes precedence.
                          <security-domain-and-application>HsqlDbRealm</security-domain-and-application>
                        -->

                        <!-- HSQL DB benefits from prepared statement caching -->
                        <prepared-statement-cache-size>32</prepared-statement-cache-size>

                        <!-- When using in-process (standalone) mode -->
                        <depends>jboss:service=Hypersonic,database=localDB</depends>
                        <!-- Uncomment when using hsqldb in server mode
                        <depends>jboss:service=Hypersonic</depends>
                        -->
                     </local-tx-datasource>

                     <!-- Uncomment if you want hsqldb accessed over tcp (server mode)
                     <mbean code="org.jboss.jdbc.HypersonicDatabase"
                       name="jboss:service=Hypersonic">
                       <attribute name="Port">1701</attribute>
                       <attribute name="BindAddress">${jboss.bind.address}</attribute>    
                       <attribute name="Silent">true</attribute>
                       <attribute name="Database">default</attribute>
                       <attribute name="Trace">false</attribute>
                       <attribute name="No_system_exit">true</attribute>
                     </mbean>
                     -->

                     <!-- For hsqldb accessed from jboss only, in-process (standalone) mode -->
                     <mbean code="org.jboss.jdbc.HypersonicDatabase"
                       name="jboss:service=Hypersonic,database=localDB">
                       <attribute name="Database">localDB</attribute>
                       <attribute name="InProcessMode">true</attribute>
                     </mbean>
                    
                  </datasources>
                  • 6. Re: seam TestNG does not work
                    suzhen Li Newbie
                    Hi Matt,

                    Same error.

                    I run it under eclipse, the pass it workspace1\OAMProject-test\bootstrap\deploy\

                    here is my one:

                    <?xml version="1.0" encoding="UTF-8"?>

                    <!-- The Hypersonic embedded database JCA connection factory config -->

                    <!-- $Id: hsqldb-ds.xml 6916 2007-12-05 17:53:00Z pmuir $ -->

                    <datasources>
                       <local-tx-datasource>

                          <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
                          <!-- Datasources are not available outside the virtual machine -->
                          <jndi-name>DefaultDS</jndi-name>

                          <!-- For server mode db, allowing other processes to use hsqldb over tcp.
                          This requires the org.jboss.jdbc.HypersonicDatabase mbean.
                          <connection-url>jdbc:hsqldb:hsql://${jboss.bind.address}:1701</connection-url>
                          -->
                          <!-- For totally in-memory db, not saved when jboss stops.
                          The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
                          <connection-url>jdbc:hsqldb:.</connection-url>
                          -->
                          <!-- For in-process persistent db, saved when jboss stops.
                          The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
                          -->
                          <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>

                          <!-- The driver class -->
                          <driver-class>org.hsqldb.jdbcDriver</driver-class>

                          <!-- The login and password -->
                          <user-name>sa</user-name>
                          <password></password>

                          <!--example of how to specify class that determines if exception means connection should be destroyed-->
                          <!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name-->

                          <!-- this will be run before a managed connection is removed from the pool for use by a client-->
                          <!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> -->

                          <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
                          <min-pool-size>0</min-pool-size>

                          <!-- The maximum connections in a pool/sub-pool -->
                          <max-pool-size>20</max-pool-size>

                          <!-- The time before an unused connection is destroyed -->
                          <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
                          <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
                          <idle-timeout-minutes>0</idle-timeout-minutes>

                          <!-- sql to call when connection is created
                            <new-connection-sql>some arbitrary sql</new-connection-sql>
                          -->

                          <!-- sql to call on an existing pooled connection when it is obtained from pool
                             <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
                          -->

                          <!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool
                             <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name>
                          -->

                          <!-- Whether to check all statements are closed when the connection is returned to the pool,
                               this is a debugging feature that should be turned off in production -->
                          <track-statements/>

                          <!-- Use the getConnection(user, pw) for logins
                            <application-managed-security/>
                          -->

                          <!-- Use the security domain defined in conf/login-config.xml -->
                          <security-domain>HsqlDbRealm</security-domain>

                          <!-- Use the security domain defined in conf/login-config.xml or the
                               getConnection(user, pw) for logins. The security domain takes precedence.
                            <security-domain-and-application>HsqlDbRealm</security-domain-and-application>
                          -->

                          <!-- HSQL DB benefits from prepared statement caching -->
                          <prepared-statement-cache-size>32</prepared-statement-cache-size>

                          <!-- When using in-process (standalone) mode -->
                          <depends>jboss:service=Hypersonic,database=localDB</depends>
                          <!-- Uncomment when using hsqldb in server mode
                          <depends>jboss:service=Hypersonic</depends>
                          -->
                       </local-tx-datasource>

                       <!-- Uncomment if you want hsqldb accessed over tcp (server mode)
                       <mbean code="org.jboss.jdbc.HypersonicDatabase"
                         name="jboss:service=Hypersonic">
                         <attribute name="Port">1701</attribute>
                         <attribute name="BindAddress">${jboss.bind.address}</attribute>    
                         <attribute name="Silent">true</attribute>
                         <attribute name="Database">default</attribute>
                         <attribute name="Trace">false</attribute>
                         <attribute name="No_system_exit">true</attribute>
                       </mbean>
                       -->

                       <!-- For hsqldb accessed from jboss only, in-process (standalone) mode -->
                       <mbean code="org.jboss.jdbc.HypersonicDatabase"
                         name="jboss:service=Hypersonic,database=localDB">
                         <attribute name="Database">localDB</attribute>
                         <attribute name="InProcessMode">true</attribute>
                       </mbean>
                      
                    </datasources>


                    Thanks,
                    • 7. Re: seam TestNG does not work
                      Matt Nirgue Newbie

                      First of all, try not to have any blank space in your workspace path (therefore: don't use your Documents And Settings)... It can only cause trouble!


                      Just so I know, do you use Maven? can you please post your classpath?

                      • 8. Re: seam TestNG does not work
                        suzhen Li Newbie

                        I do not use Maven. I run my test on the eclipse(I pluge Test-eclispe pluging on my eclipse).
                        The java build path on eclipse is OAMProject-test/bin
                        the file hsqldb-ds.xml is under OAMProject-test/bootstrap/deploy/.



                        Do I list right info.


                        Thanks, suzhen

                        • 9. Re: seam TestNG does not work
                          suzhen Li Newbie
                          Hi Matt,
                          I resolved the path issue, now I get back too begin issue:
                          persistence.units:unitName=OAMProject
                          -> <UNKNOWN>{Described:** UNRESOLVED Demands 'jboss.jca:name=comp/env/jdbc/OAMProjectDB,service=DataSourceBinding **}.

                          Let me descript how I create the seam project from eclipse.

                          1. File->New->Seam Web Project
                          2. fill all required fields.
                          3. modify persistence.xml which created when the seam project created.
                          4. modify components.xml to following:
                          <?xml version="1.0" encoding="UTF-8"?>
                          <components xmlns="http://jboss.com/products/seam/components"
                                      xmlns:core="http://jboss.com/products/seam/core"
                                      xmlns:persistence="http://jboss.com/products/seam/persistence"
                                      xmlns:transaction="http://jboss.com/products/seam/transaction"
                                      xmlns:security="http://jboss.com/products/seam/security"
                                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                      xmlns:web="http://jboss.com/products/seam/web"
                                      xsi:schemaLocation=
                                          "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
                                           http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
                                           http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd
                                           http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
                                           http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
                               

                              <core:manager conversation-timeout="120000"
                                            concurrent-request-timeout="500"
                                            conversation-id-parameter="cid"/>
                             
                             <transaction:entity-transaction entity-manager="#{em}"/>
                                           
                              <persistence:entity-manager-factory name="OAMProject"/>
                             
                              <persistence:managed-persistence-context name="em"
                                                         auto-create="true"
                                              entity-manager-factory="#{OAMProject}"/>
                                             
                              <security:identity authenticate-method="#{authenticator.authenticate}"/> 
                               
                          </components>

                          5. create /WebContent/META_INF/context.xml
                          <Context path="/OAMProject" docBase="OAMProject"
                                  debug="5" reloadable="true" crossContext="true">

                            <Resource name="jdbc/OAMProjectDB" auth="Container" type="javax.sql.DataSource"
                                         maxActive="100" maxIdle="30" maxWait="10000"
                                         username="avaya" driverClassName="org.postgresql.Driver"
                                         url="jdbc:postgresql://ip:port/databasename"/>
                          </Context>


                          6. create a new seam-action
                          7. run the test


                          Did I do some wrong?

                          Thanks,

                          • 10. Re: seam TestNG does not work
                            suzhen Li Newbie
                            <blockquote>
                            _suzhen Li wrote on Oct 28, 2008 20:35:_<br/>

                            Hi Matt,
                            I resolved the path issue, now I get back too begin issue:
                            persistence.units:unitName=OAMProject
                            -> <UNKNOWN>{Described:** UNRESOLVED Demands 'jboss.jca:name=comp/env/jdbc/OAMProjectDB,service=DataSourceBinding **}.

                            Let me descript how I create the seam project from eclipse.

                            1. File->New->Seam Web Project
                            2. fill all required fields.
                            3. modify persistence.xml which created when the seam project created.
                            4. modify components.xml to following:
                            <?xml version="1.0" encoding="UTF-8"?>
                            <components xmlns="http://jboss.com/products/seam/components"
                                        xmlns:core="http://jboss.com/products/seam/core"
                                        xmlns:persistence="http://jboss.com/products/seam/persistence"
                                        xmlns:transaction="http://jboss.com/products/seam/transaction"
                                        xmlns:security="http://jboss.com/products/seam/security"
                                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                        xmlns:web="http://jboss.com/products/seam/web"
                                        xsi:schemaLocation=
                                            "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
                                             http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
                                             http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd
                                             http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
                                             http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
                                   

                                <core:manager conversation-timeout="120000"
                                              concurrent-request-timeout="500"
                                              conversation-id-parameter="cid"/>
                               
                               <transaction:entity-transaction entity-manager="#{em}"/>
                                             
                                <persistence:entity-manager-factory name="OAMProject"/>
                               
                                <persistence:managed-persistence-context name="em"
                                                           auto-create="true"
                                                entity-manager-factory="#{OAMProject}"/>
                                               
                                <security:identity authenticate-method="#{authenticator.authenticate}"/> 
                                 
                            </components>

                            5. create /WebContent/META_INF/context.xml
                            <Context path="/OAMProject" docBase="OAMProject"
                                    debug="5" reloadable="true" crossContext="true">

                              <Resource name="jdbc/OAMProjectDB" auth="Container" type="javax.sql.DataSource"
                                           maxActive="100" maxIdle="30" maxWait="10000"
                                           username=test driverClassName="org.postgresql.Driver"
                                           url="jdbc:postgresql://ip:port/databasename"/>
                            </Context>


                            6. create a new seam-action
                            7. run the test


                            Did I do some wrong?

                            Thanks,


                            </blockquote>

                            Click HELP for text formatting instructions. Then edit this text and check the preview.
                            • 11. Re: seam TestNG does not work
                              suzhen Li Newbie
                              <blockquote>
                              _suzhen Li wrote on Oct 28, 2008 20:36:_<br/>

                              <blockquote>
                              _suzhen Li wrote on Oct 28, 2008 20:35:_<br/>

                              Hi Matt,
                              I resolved the path issue, now I get back too begin issue:
                              persistence.units:unitName=OAMProject
                              -> <UNKNOWN>{Described:** UNRESOLVED Demands 'jboss.jca:name=comp/env/jdbc/OAMProjectDB,service=DataSourceBinding **}.

                              Let me descript how I create the seam project from eclipse.

                              1. File->New->Seam Web Project
                              2. fill all required fields.
                              3. modify persistence.xml which created when the seam project created.
                              4. modify components.xml to following:
                              <?xml version="1.0" encoding="UTF-8"?>
                              <components xmlns="http://jboss.com/products/seam/components"
                                          xmlns:core="http://jboss.com/products/seam/core"
                                          xmlns:persistence="http://jboss.com/products/seam/persistence"
                                          xmlns:transaction="http://jboss.com/products/seam/transaction"
                                          xmlns:security="http://jboss.com/products/seam/security"
                                          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                          xmlns:web="http://jboss.com/products/seam/web"
                                          xsi:schemaLocation=
                                              "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
                                               http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
                                               http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd
                                               http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
                                               http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
                                     

                                  <core:manager conversation-timeout="120000"
                                                concurrent-request-timeout="500"
                                                conversation-id-parameter="cid"/>
                                 
                                 <transaction:entity-transaction entity-manager="#{em}"/>
                                               
                                  <persistence:entity-manager-factory name="OAMProject"/>
                                 
                                  <persistence:managed-persistence-context name="em"
                                                             auto-create="true"
                                                  entity-manager-factory="#{OAMProject}"/>
                                                 
                                  <security:identity authenticate-method="#{authenticator.authenticate}"/> 
                                   
                              </components>

                              5. create /WebContent/META_INF/context.xml
                              <Context path="/OAMProject" docBase="OAMProject"
                                      debug="5" reloadable="true" crossContext="true">

                                <Resource name="jdbc/OAMProjectDB" auth="Container" type="javax.sql.DataSource"
                                             maxActive="100" maxIdle="30" maxWait="10000"
                                             username="test" driverClassName="org.postgresql.Driver"
                                             url="jdbc:postgresql://ip:port/databasename"/>
                              </Context>


                              6. create a new seam-action
                              7. run the test


                              Did I do some wrong?

                              Thanks,


                              </blockquote>

                              Click HELP for text formatting instructions. Then edit this text and check the preview.
                              </blockquote>

                              Click HELP for text formatting instructions. Then edit this text and check the preview.
                              • 12. Re: seam TestNG does not work
                                Matt Nirgue Newbie
                                In my project, I don't use the context.xml file so I don't know how Embedded JBoss handle this file (if it handles it at all).

                                I looked back on your posts and what I find odd is that you defined a datasource called "OAMDatasource" in your oam-test-ds.xml:
                                <local-tx-datasource>
                                      <jndi-name>OAMDatasource</jndi-name>
                                ...

                                but you're looking for a datasource called OAMProjectDB in your persistence.xml:
                                <persistence-unit name="OAMProject">
                                      <provider>org.hibernate.ejb.HibernatePersistence</provider>
                                      <jta-data-source>java:/OAMProjectDB</jta-data-source>
                                ...

                                What happens if put something like this in your persistence.xml
                                      <jta-data-source>java:/OAMDatasource</jta-data-source>
                                ???
                                • 13. Re: seam TestNG does not work
                                  suzhen Li Newbie
                                  Hi Matt,

                                  Follow your idea change persistence.xml and *ds-xml file, I resolved the " -> <UNKNOWN>{Described:** UNRESOLVED Demands 'jboss.jca:name=comp/env/jdbc/OAMProjectDB,service=DataSourceBinding **}" issue.

                                  But this cause my seam project not running. When I load xhtml page, I got following error:
                                  Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not find datasource
                                       at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:737)
                                       at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
                                       at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
                                       at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
                                       at org.jboss.seam.persistence.EntityManagerFactory.createEntityManagerFactory(EntityManagerFactory.java:81)
                                       at org.jboss.seam.persistence.EntityManagerFactory.startup(EntityManagerFactory.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:21)
                                       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
                                       at org.jboss.seam.Component.callComponentMethod(Component.java:2100)
                                       at org.jboss.seam.Component.callCreateMethod(Component.java:2015)
                                       at org.jboss.seam.Component.newInstance(Component.java:1976)
                                       ... 20 more
                                  Caused by: org.hibernate.HibernateException: Could not find datasource
                                       at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
                                       at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
                                       at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
                                       at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
                                       at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
                                       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
                                       at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
                                       at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:730)
                                       ... 34 more
                                  Caused by: javax.naming.NameNotFoundException: Name OAMProjectDB is not bound in this Context
                                       at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
                                       at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
                                       at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
                                       at javax.naming.InitialContext.lookup(InitialContext.java:351)
                                       at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)




                                  Ny persistence.xml is:
                                  <?xml version="1.0" encoding="UTF-8"?>
                                  <!-- Persistence deployment descriptor for dev profile -->
                                  <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                                               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                               xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                                               version="1.0">
                                              
                                       <persistence-unit name="OAMProject" transaction-type="JTA">
                                        <provider>org.hibernate.ejb.HibernatePersistence</provider>
                                        <jta-data-source>java:/OAMProjectDB</jta-data-source>
                                        <properties>
                                           <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
                                           <property name="hibernate.show_sql" value="true"/>
                                           <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
                                        <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>

                                        </properties>
                                     </persistence-unit>


                                  Please help me.
                                  Thanks,
                                  • 14. Re: seam TestNG does not work
                                    Matt Nirgue Newbie

                                    Don't know why your app is still looking for:


                                    comp/env/jdbc/OAMProjectDB



                                    do you have different persistence.xml files? (If you do, where did you put them?)

                                    1 2 Previous Next