2 Replies Latest reply on Nov 18, 2010 11:08 AM by Ruben Lopez

    Testing in Embedded Jboss with a Postgres database fails to connect

    Ruben Lopez Newbie

      Hi everyone.


      I'm trying to test an aplication generated with seam-gen, using a postgres database. It works ok in development mode.


      I followed the steps in http://seamframework.org/Documentation/HowDoIUseADifferentDatabaseWithEmbeddedJBoss


      My data source configuration file epw-test-ds:


      <?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>epwDatasource</jndi-name>
            <connection-url>jdbc:postgresql://localhost:5432/epw</connection-url>
            <driver-class>org.postgresql.Driver</driver-class>
            <user-name>postgres</user-name>
            <password>admin</password>
         </local-tx-datasource>
      </datasources>
      



      The persistence unit descriptor persistence-test.xml:


      <?xml version="1.0" encoding="UTF-8"?>
           <!-- Persistence deployment descriptor for tests -->
      <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="epw">
                <provider>org.hibernate.ejb.HibernatePersistence</provider>
                <jta-data-source>java:/epwDatasource</jta-data-source>
                <properties>
                     <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
                     <property name="hibernate.hbm2ddl.auto" value="create" />
                     <property name="hibernate.show_sql" value="true" />
                     <property name="hibernate.format_sql" value="true" />
                     <property name="jboss.entity.manager.factory.jndi.name"
                          value="java:/epwEntityManagerFactory" />
                     
                     <!-- enable database audit with envers -->
                     <property name="hibernate.ejb.event.post-insert"
                          value="org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener" />
                     <property name="hibernate.ejb.event.post-update"
                          value="org.hibernate.ejb.event.EJB3PostUpdateEventListener,org.hibernate.envers.event.AuditEventListener" />
                     <property name="hibernate.ejb.event.post-delete"
                          value="org.hibernate.ejb.event.EJB3PostDeleteEventListener,org.hibernate.envers.event.AuditEventListener" />
                     <property name="hibernate.ejb.event.pre-collection-update"
                          value="org.hibernate.envers.event.AuditEventListener" />
                     <property name="hibernate.ejb.event.pre-collection-remove"
                          value="org.hibernate.envers.event.AuditEventListener" />
                     <property name="hibernate.ejb.event.post-collection-recreate"
                          value="org.hibernate.envers.event.AuditEventListener" />
                </properties>
           </persistence-unit>
      </persistence>
      



      I copied postgresql-8.4-701.jdbc4.jar in the lib floder.


      I use:



      • jboss-seam-2.2.0.GA

      • apache ant 1.8.1



      I get the following error:


         [testng] Failed to invoke @Configuration method org.jboss.seam.mock.SeamTest.
      startSeam:Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
         [testng]
         [testng] *** CONTEXTS IN ERROR: Name -> Error
         [testng]
         [testng] vfsfile:/C:/Users/Ruben/Desktop/epw/ep/fuente/epw/bootstrap/deploy/e
      pw-test-ds.xml -> java.net.ConnectException: Connection timed out: connect
      



      and


         [testng] *********** INVOKED METHODS
         [testng]
         [testng]             py.cnc.epweb.test.DepartamentoTest.testLogin() 24374930
         [testng]             py.cnc.epweb.test.DepartamentoTest.shouldAuthenticate()
      24374930
         [testng]
         [testng] ***********
         [testng]
         [testng] Creating C:\Users\Ruben\Desktop\epw\ep\fuente\epw\test-report\tests\
      test de Departamentos.html
         [testng] Creating C:\Users\Ruben\Desktop\epw\ep\fuente\epw\test-report\tests\
      test de Departamentos.xml
         [testng] FAILED CONFIGURATION: @BeforeSuite startSeam
         [testng] org.jboss.deployers.client.spi.IncompleteDeploymentException: Summar
      y of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
         [testng]
         [testng] *** CONTEXTS IN ERROR: Name -> Error
         [testng]
         [testng] vfsfile:/C:/Users/Ruben/Desktop/epw/ep/fuente/epw/bootstrap/deploy/e
      pw-test-ds.xml -> java.net.ConnectException: Connection timed out: connect
         [testng]
         [testng]
         [testng]     at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComp
      lete(DeployersImpl.java:576)
         [testng]     at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComple
      te(MainDeployerImpl.java:559)
         [testng]     at org.jboss.embedded.Bootstrap.bootstrapURL(Bootstrap.java:149)
      
         [testng]     at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:183)
         [testng]     at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:195)
         [testng]     at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources
      (EmbeddedBootstrap.java:11)
         [testng]     at org.jboss.seam.mock.AbstractSeamTest.startJbossEmbeddedIfNece
      ssary(AbstractSeamTest.java:1024)
         [testng]     at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTe
      st.java:915)
         [testng]     at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:58)
         [testng] ... Removed 15 stack frames
         [testng] SKIPPED CONFIGURATION: @BeforeClass setupClass
         [testng] SKIPPED CONFIGURATION: @BeforeMethod begin
         [testng] SKIPPED CONFIGURATION: @AfterMethod end
         [testng] SKIPPED CONFIGURATION: @BeforeMethod begin
         [testng] SKIPPED CONFIGURATION: @AfterMethod end
         [testng] SKIPPED CONFIGURATION: @AfterClass cleanupClass
         [testng] SKIPPED: testLogin
         [testng] SKIPPED: shouldAuthenticate
      



      Is there something wrong with the configuration files?.

        • 1. Re: Testing in Embedded Jboss with a Postgres database fails to connect
          Ruben Lopez Newbie

          Hi.


          I solved the problem by dropping the DOCTYPE from the -ds.xml file and now I have this error:


             [testng] [Invoker 7219514] Invoking @BeforeSuite org.jboss.seam.mock.SeamTest.startSeam()
             [testng] Failed to invoke @Configuration method org.jboss.seam.mock.SeamTest.startSeam:Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
             [testng] 
             [testng] *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}
             [testng] 
             [testng] jboss.jca:name=JmsXA,service=ConnectionFactoryBinding
             [testng]  -> jboss.jca:name=JmsXA,service=TxCM{Create:Configured}
             [testng]  -> jboss.jca:name=JmsXA,service=TxCM{Start:Configured}
             [testng] 
             [testng] jboss.jca:name=JmsXA,service=ManagedConnectionFactory
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng] 
             [testng] jboss.jca:name=JmsXA,service=ManagedConnectionPool
             [testng]  -> jboss.jca:name=JmsXA,service=ManagedConnectionFactory{Create:Configured}
             [testng]  -> jboss.jca:name=JmsXA,service=ManagedConnectionFactory{Start:Configured}
             [testng] 
             [testng] jboss.jca:name=JmsXA,service=TxCM
             [testng]  -> jboss.jca:name=JmsXA,service=ManagedConnectionPool{Create:Configured}
             [testng]  -> jboss.jca:name=JmsXA,service=ManagedConnectionPool{Start:Configured}
             [testng] 
             [testng] jboss.messaging.connectionfactory:service=ClusterPullConnectionFactory
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Create:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Start:Configured}
             [testng] 
             [testng] jboss.messaging.connectionfactory:service=ClusteredConnectionFactory
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Start:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Create:Configured}
             [testng] 
             [testng] jboss.messaging.connectionfactory:service=ConnectionFactory
             [testng]  -> jboss.messaging:service=PostOffice{Create:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Start:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng] 
             [testng] jboss.messaging.destination:name=DLQ,service=Queue
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Create:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Start:Configured}
             [testng] 
             [testng] jboss.messaging.destination:name=ExpiryQueue,service=Queue
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Create:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Start:Configured}
             [testng] 
             [testng] jboss.messaging:service=JMSUserManager
             [testng]  -> jboss.jca:name=DefaultDS,service=DataSourceBinding{Create:** NOT FOUND **}
             [testng]  -> jboss.jca:name=DefaultDS,service=DataSourceBinding{Start:** NOT FOUND **}
             [testng] 
             [testng] jboss.messaging:service=PersistenceManager
             [testng]  -> jboss.jca:name=DefaultDS,service=DataSourceBinding{Start:** NOT FOUND **}
             [testng]  -> jboss.jca:name=DefaultDS,service=DataSourceBinding{Create:** NOT FOUND **}
             [testng] 
             [testng] jboss.messaging:service=PostOffice
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng]  -> jboss.jca:name=DefaultDS,service=DataSourceBinding{Create:** NOT FOUND **}
             [testng]  -> jboss.jca:name=DefaultDS,service=DataSourceBinding{Start:** NOT FOUND **}
             [testng] 
             [testng] jboss.messaging:service=ServerPeer
             [testng]  -> jboss.messaging:service=JMSUserManager{Start:Configured}
             [testng]  -> jboss.messaging:service=PersistenceManager{Start:Configured}
             [testng]  -> jboss.messaging:service=PersistenceManager{Create:Configured}
             [testng]  -> jboss.messaging:service=JMSUserManager{Create:Configured}
             [testng] 
             [testng] jboss.mq:service=DestinationManager
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng] 
             [testng] 
             [testng] *** CONTEXTS IN ERROR: Name -> Error
             [testng] 
             [testng] jboss.jca:name=DefaultDS,service=DataSourceBinding -> ** NOT FOUND **
             [testng] 
             [testng] 
             [testng] [SuiteRunner] Created 1 TestRunners
             [testng] [TestRunner] Running test FooTest on 1  classes,  included groups:[] excluded groups:[]
             [testng] [TestClass] 
             [testng] ======
             [testng] TESTCLASS: py.cnc.epweb.test.FooTest
             [testng] [TestClass] BeforeClass : org.jboss.seam.mock.SeamTest.setupClass()
             [testng] [TestClass] BeforeMethod:     org.jboss.seam.mock.SeamTest.begin()
             [testng] [TestClass] Test        :          py.cnc.epweb.test.FooTest.myFirstTest()
             [testng] [TestClass] Test        :          py.cnc.epweb.test.FooTest.mySecondTest()
             [testng] [TestClass] AfterMethod :     org.jboss.seam.mock.SeamTest.end()
             [testng] [TestClass] AfterClass  : org.jboss.seam.mock.SeamTest.cleanupClass()
             [testng] [TestClass] 
             [testng] ======
             [testng] 
             [testng] [TestRunner] Found 2 applicable methods
             [testng] [TestRunner] WILL BE RUN IN RANDOM ORDER:
             [testng] [TestRunner]   py.cnc.epweb.test.FooTest.myFirstTest()
             [testng] [TestRunner]       on instances
             [testng] [TestRunner]      py.cnc.epweb.test.FooTest@e2fa0e
             [testng] [TestRunner]   py.cnc.epweb.test.FooTest.mySecondTest()
             [testng] [TestRunner]       on instances
             [testng] [TestRunner]      py.cnc.epweb.test.FooTest@e2fa0e
             [testng] [TestRunner] ===
             [testng] 
             [testng] *********** INVOKED METHODS
             [testng] 
             [testng]           py.cnc.epweb.test.FooTest.myFirstTest() 14875150
             [testng]           py.cnc.epweb.test.FooTest.mySecondTest() 14875150
             [testng] 
             [testng] ***********
             [testng] 
             [testng] Creating C:\Users\Ruben\Desktop\epw\ep\fuente\epw\test-report\tests\FooTest.html
             [testng] Creating C:\Users\Ruben\Desktop\epw\ep\fuente\epw\test-report\tests\FooTest.xml
             [testng] FAILED CONFIGURATION: @BeforeSuite startSeam
             [testng] org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
             [testng] 
             [testng] *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}
             [testng] 
             [testng] jboss.jca:name=JmsXA,service=ConnectionFactoryBinding
             [testng]  -> jboss.jca:name=JmsXA,service=TxCM{Create:Configured}
             [testng]  -> jboss.jca:name=JmsXA,service=TxCM{Start:Configured}
             [testng] 
             [testng] jboss.jca:name=JmsXA,service=ManagedConnectionFactory
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng] 
             [testng] jboss.jca:name=JmsXA,service=ManagedConnectionPool
             [testng]  -> jboss.jca:name=JmsXA,service=ManagedConnectionFactory{Create:Configured}
             [testng]  -> jboss.jca:name=JmsXA,service=ManagedConnectionFactory{Start:Configured}
             [testng] 
             [testng] jboss.jca:name=JmsXA,service=TxCM
             [testng]  -> jboss.jca:name=JmsXA,service=ManagedConnectionPool{Create:Configured}
             [testng]  -> jboss.jca:name=JmsXA,service=ManagedConnectionPool{Start:Configured}
             [testng] 
             [testng] jboss.messaging.connectionfactory:service=ClusterPullConnectionFactory
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Create:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Start:Configured}
             [testng] 
             [testng] jboss.messaging.connectionfactory:service=ClusteredConnectionFactory
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Start:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Create:Configured}
             [testng] 
             [testng] jboss.messaging.connectionfactory:service=ConnectionFactory
             [testng]  -> jboss.messaging:service=PostOffice{Create:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Start:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng] 
             [testng] jboss.messaging.destination:name=DLQ,service=Queue
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Create:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Start:Configured}
             [testng] 
             [testng] jboss.messaging.destination:name=ExpiryQueue,service=Queue
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Create:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng]  -> jboss.messaging:service=PostOffice{Start:Configured}
             [testng] 
             [testng] jboss.messaging:service=JMSUserManager
             [testng]  -> jboss.jca:name=DefaultDS,service=DataSourceBinding{Create:** NOT FOUND **}
             [testng]  -> jboss.jca:name=DefaultDS,service=DataSourceBinding{Start:** NOT FOUND **}
             [testng] 
             [testng] jboss.messaging:service=PersistenceManager
             [testng]  -> jboss.jca:name=DefaultDS,service=DataSourceBinding{Start:** NOT FOUND **}
             [testng]  -> jboss.jca:name=DefaultDS,service=DataSourceBinding{Create:** NOT FOUND **}
             [testng] 
             [testng] jboss.messaging:service=PostOffice
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng]  -> jboss.jca:name=DefaultDS,service=DataSourceBinding{Create:** NOT FOUND **}
             [testng]  -> jboss.jca:name=DefaultDS,service=DataSourceBinding{Start:** NOT FOUND **}
             [testng] 
             [testng] jboss.messaging:service=ServerPeer
             [testng]  -> jboss.messaging:service=JMSUserManager{Start:Configured}
             [testng]  -> jboss.messaging:service=PersistenceManager{Start:Configured}
             [testng]  -> jboss.messaging:service=PersistenceManager{Create:Configured}
             [testng]  -> jboss.messaging:service=JMSUserManager{Create:Configured}
             [testng] 
             [testng] jboss.mq:service=DestinationManager
             [testng]  -> jboss.messaging:service=ServerPeer{Create:Configured}
             [testng]  -> jboss.messaging:service=ServerPeer{Start:Configured}
             [testng] 
             [testng] 
             [testng] *** CONTEXTS IN ERROR: Name -> Error
             [testng] 
             [testng] jboss.jca:name=DefaultDS,service=DataSourceBinding -> ** NOT FOUND **
             [testng] 
             [testng] 
             [testng]      at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:576)
             [testng]      at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:559)
             [testng]      at org.jboss.embedded.Bootstrap.bootstrapURL(Bootstrap.java:149)
             [testng]      at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:183)
             [testng]      at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:195)
             [testng]      at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:11)
             [testng]      at org.jboss.seam.mock.AbstractSeamTest.startJbossEmbeddedIfNecessary(AbstractSeamTest.java:1024)
             [testng]      at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:915)
             [testng]      at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:58)
             [testng] ... Removed 15 stack frames
             [testng] SKIPPED CONFIGURATION: @BeforeClass setupClass
             [testng] SKIPPED CONFIGURATION: @BeforeMethod begin
             [testng] SKIPPED CONFIGURATION: @AfterMethod end
             [testng] SKIPPED CONFIGURATION: @BeforeMethod begin
             [testng] SKIPPED CONFIGURATION: @AfterMethod end
             [testng] SKIPPED CONFIGURATION: @AfterClass cleanupClass
             [testng] SKIPPED: myFirstTest
             [testng] SKIPPED: mySecondTest
             [testng] 
             [testng] ===============================================
             [testng]     FooTest
             [testng]     Tests run: 2, Failures: 0, Skips: 2
             [testng]     Configuration Failures: 1, Skips: 6
             [testng] ===============================================
          
          



          Can anyone help me please?

          • 2. Re: Testing in Embedded Jboss with a Postgres database fails to connect
            Ruben Lopez Newbie

            Nevermind...  I deleted the DefaultDS from the deploy folder, I restored that file and everything works ok