2 Replies Latest reply on Oct 21, 2013 10:37 AM by rcorak

    Problem creating a connection to Postgresql V9

    rcorak

      I am getting a series of errors trying to setup a datasource to Postgresql V9.  Below is the log file with the errors:

       

      07:31:00,634 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 48) JBAS011402: Starting Persistence Unit Service 'MyWorkbench.war#primary'

      07:31:00,747 INFO  [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 48) HCANN000001: Hibernate Commons Annotations {4.0.1.Final-redhat-2}

      07:31:00,750 INFO  [org.hibernate.Version] (ServerService Thread Pool -- 48) HHH000412: Hibernate Core {4.2.0.Final-redhat-1}

      07:31:00,751 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 48) HHH000206: hibernate.properties not found

      07:31:00,752 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 48) HHH000021: Bytecode provider name : javassist

      07:31:00,763 INFO  [org.hibernate.ejb.Ejb3Configuration] (ServerService Thread Pool -- 48) HHH000204: Processing PersistenceUnitInfo [

        name: primary

        ...]

      07:31:00,881 INFO  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (ServerService Thread Pool -- 48) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider

      07:31:01,911 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (ServerService Thread Pool -- 48) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection

        at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:282)

        at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:240)

        at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:781)

        at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:344)

        at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)

        at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)

        at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)

        at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)

        at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:117) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:78) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2283) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2279) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1748) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:920) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:92) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_40]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_40]

        at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_40]

        at org.jboss.threads.JBossThread.run(JBossThread.java:122)

      Caused by: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:138)

        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)

        at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125)

        at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)

        at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22)

        at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:32)

        at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)

        at org.postgresql.Driver.makeConnection(Driver.java:393)

        at org.postgresql.Driver.connect(Driver.java:267)

        at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:254)

        ... 30 more

      Caused by: java.net.ConnectException: Connection refused: connect

        at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method) [rt.jar:1.7.0_40]

        at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.AbstractPlainSocketImpl.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.PlainSocketImpl.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.SocksSocketImpl.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.Socket.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.Socket.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.Socket.<init>(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.Socket.<init>(Unknown Source) [rt.jar:1.7.0_40]

        at org.postgresql.core.PGStream.<init>(PGStream.java:62)

        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:76)

        ... 39 more

       

       

      07:31:01,941 WARN  [org.hibernate.engine.jdbc.internal.JdbcServicesImpl] (ServerService Thread Pool -- 48) HHH000342: Could not obtain connection to query metadata : javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/MyWorkbenchDS

      07:31:01,945 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 48) HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect

      07:31:01,950 INFO  [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (ServerService Thread Pool -- 48) HHH000422: Disabling contextual LOB creation as connection was null

      07:31:01,956 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (ServerService Thread Pool -- 48) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory

      07:31:01,959 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 48) HHH000397: Using ASTQueryTranslatorFactory

      07:31:01,986 INFO  [org.hibernate.validator.internal.util.Version] (ServerService Thread Pool -- 48) HV000001: Hibernate Validator 4.3.1.Final-redhat-1

      07:31:02,209 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 48) HHH000227: Running hbm2ddl schema export

      07:31:03,232 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (ServerService Thread Pool -- 48) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection

        at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:282)

        at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:240)

        at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:781)

        at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:344)

        at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)

        at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)

        at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)

        at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)

        at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.tool.hbm2ddl.DatabaseExporter.<init>(DatabaseExporter.java:52) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:367) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:304) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:293) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:500) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1750) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:920) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:92) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_40]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_40]

        at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_40]

        at org.jboss.threads.JBossThread.run(JBossThread.java:122)

      Caused by: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:138)

        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)

        at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125)

        at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)

        at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22)

        at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:32)

        at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)

        at org.postgresql.Driver.makeConnection(Driver.java:393)

        at org.postgresql.Driver.connect(Driver.java:267)

        at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:254)

        ... 28 more

      Caused by: java.net.ConnectException: Connection refused: connect

        at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method) [rt.jar:1.7.0_40]

        at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.AbstractPlainSocketImpl.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.PlainSocketImpl.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.SocksSocketImpl.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.Socket.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.Socket.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.Socket.<init>(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.Socket.<init>(Unknown Source) [rt.jar:1.7.0_40]

        at org.postgresql.core.PGStream.<init>(PGStream.java:62)

        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:76)

        ... 37 more

       

       

      07:31:03,244 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 48) HHH000231: Schema export unsuccessful: java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/MyWorkbenchDS

        at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:147)

        at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.tool.hbm2ddl.DatabaseExporter.<init>(DatabaseExporter.java:52) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:367) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:304) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:293) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:500) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1750) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:920) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:92) [hibernate-entitymanager-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_40]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_40]

        at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_40]

        at org.jboss.threads.JBossThread.run(JBossThread.java:122)

      Caused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/MyWorkbenchDS

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:390)

        at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)

        at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)

        ... 19 more

      Caused by: javax.resource.ResourceException: IJ000658: Unexpected throwable while trying to create a connection: null

        at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:377)

        at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)

        at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)

        ... 22 more

      Caused by: javax.resource.ResourceException: Could not create connection

        at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:282)

        at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:240)

        at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:781)

        at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:344)

        ... 25 more

      Caused by: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:138)

        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)

        at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125)

        at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)

        at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22)

        at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:32)

        at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)

        at org.postgresql.Driver.makeConnection(Driver.java:393)

        at org.postgresql.Driver.connect(Driver.java:267)

        at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:254)

        ... 28 more

      Caused by: java.net.ConnectException: Connection refused: connect

        at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method) [rt.jar:1.7.0_40]

        at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.AbstractPlainSocketImpl.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.PlainSocketImpl.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.SocksSocketImpl.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.Socket.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.Socket.connect(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.Socket.<init>(Unknown Source) [rt.jar:1.7.0_40]

        at java.net.Socket.<init>(Unknown Source) [rt.jar:1.7.0_40]

        at org.postgresql.core.PGStream.<init>(PGStream.java:62)

        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:76)

        ... 37 more

       

      =================================================

      This is my persistence.xml:

       

      <persistence version="2.0"

         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_2_0.xsd">

         <persistence-unit name="primary">

            <!-- If you are running in a production environment, add a managed

               data source, this example data source is just for development and testing! -->

            <!-- The datasource is deployed as WEB-INF/MyWorkbench-ds.xml, you

               can find it in the source at src/main/webapp/WEB-INF/MyWorkbench-ds.xml -->

            <jta-data-source>java:jboss/datasources/MyWorkbenchDS</jta-data-source>

            <properties>

               <!-- Properties for Hibernate -->

               <property name="hibernate.hbm2ddl.auto" value="create-drop" />

               <property name="hibernate.show_sql" value="false" />

        <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />

            </properties>

         </persistence-unit>

      </persistence>

       

      ======================================================

       

      This is my MyWorkbenchDS.xml

       

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

      <datasources xmlns="http://www.jboss.org/ironjacamar/schema">

      <datasource jndi-name="java:jboss/datasources/MyWorkbenchDS" enabled="true"

           use-java-context="true" pool-name="MyWorkbench">

        <connection-url>jdbc:postgresql://localhost:5433/MyDB</connection-url>

        <driver>postgresql-9.1-901.jdbc4.jar</driver>

        <pool></pool>

        <security>

         <user-name>rob</user-name>

         <password>robpw</password>

        </security>

      </datasource>

      </datasources>

       

      ===============================================

       

      Please let me know if there is any additional information needed.

       

      Any thoughts on where things are going bad?

       

      Thanks in advance for your help.

       

      Regards,

       

      Rob

        • 1. Re: Problem creating a connection to Postgresql V9
          wdfink

          I suppose you are using an EAP6 version.

          Where is the DS configured, do you install the driver as module?

           

          Also do a simple check to be sure that the DB is working with that parameter, you might use SQirreL which connect as Java JDBC client similar to the server.

          • 2. Re: Problem creating a connection to Postgresql V9
            rcorak

            Thank you for your response.

             

            I am using EAP6 community version.

             

            I was able to configure an ODBC connection as a test using: //localhost:5433/MyDB

             

            The Test Connection was successful.  Hopefully this serves the same purpose.

             

            I had not installed the driver as a module.  I just created a folder under modules\com\postgres\main and copied in the postgres jar file and created a module.xml that looks like this:

             

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

            <module xmlns="urn:jboss:module:1.0" name="com.postgres">

              <resources>

                <resource-root path="postgresql-9.1-901.jdbc4.jar"/>

              </resources>

              <dependencies>

                <module name="javax.api"/>

              </dependencies>

            </module>

             

             

            I modified standalone.bat datasources entry to include postgres.

             

                        <datasources>

            <datasource jndi-name="java:jboss/datasourcesMyWorkbenchDS" pool-name="MyWorkbenchDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">

               <connection-url>jdbc:postgresql://localhost:5433/MyDB</connection-url>

               <driver>com.postgres</driver>

               <pool>

                   <min-pool-size>1</min-pool-size>

                   <max-pool-size>4</max-pool-size>

                   <prefill>false</prefill>

                   <use-strict-min>false</use-strict-min>

                  <flush-strategy>FailingConnectionOnly</flush-strategy>

               </pool>

                   <security>

                         <user-name>user</user-name>

                         <password>mypwd</password>

                   </security>

            </datasource>

            ...  registratuion of the h2 driver as exampleDS ...

            <drivers>

            <driver name="com.postgres" module="com.postgres">

                   <xa-datasource-class>com.postgres.xa.PGXADataSource</xa-datasource-class>

            </driver>

            <driver name="h2" ...

            </driver>

            </drivers>

            </datasources>

             

            ===============================

             

            Now I am getting an error that I have duplicate registrations.  I assume it has something to do with the fact that I have a module.xml and a local DS file and reference to the DS in my persistence.  Unfortunately I'm not sure when you use the module folder for installing the driver what other components are necessary in the configuration and which ones are redundant.

             

            This is the latest log file:

             

            10:30:01,215 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (IronJacamar 1.0.17.Final-redhat-1)

            10:30:01,265 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 25) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.1)

            10:30:01,268 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-5) JBAS015400: Bound mail session [java:jboss/mail/Default]

            10:30:01,295 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 25) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)

            10:30:01,450 INFO  [org.jboss.ws.common.management] (MSC service thread 1-7) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.1.3.Final-redhat-3

            10:30:01,806 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) JBAS015012: Started FileSystemDeploymentService for directory C:\Users\rcorak\jbdevstudio\runtimes\jboss-eap\standalone\deployments

            10:30:01,813 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "MyWorkbench.war" (runtime-name: "MyWorkbench.war")

            10:30:01,926 INFO  [org.jboss.as.remoting] (MSC service thread 1-6) JBAS017100: Listening on 127.0.0.1:9999

            10:30:01,926 INFO  [org.jboss.as.remoting] (MSC service thread 1-2) JBAS017100: Listening on 127.0.0.1:4447

            10:30:01,939 INFO  [org.apache.coyote.http11] (MSC service thread 1-4) JBWEB003001: Coyote HTTP/1.1 initializing on : http-/127.0.0.1:8080

            10:30:01,944 INFO  [org.apache.coyote.http11] (MSC service thread 1-4) JBWEB003000: Coyote HTTP/1.1 starting on: http-/127.0.0.1:8080

            10:30:02,063 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:jboss/datasources/MyWorkbenchDS]

            10:30:02,065 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]

            10:30:04,405 INFO  [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011401: Read persistence.xml for primary

            10:30:04,625 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."MyWorkbench.war".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."MyWorkbench.war".FIRST_MODULE_USE: JBAS018733: Failed to process phase FIRST_MODULE_USE of deployment "MyWorkbench.war"

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

              at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_40]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_40]

              at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_40]

            Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS010464: Exception deploying datasource java:jboss/datasources/MyWorkbenchDS

              at org.jboss.as.connector.deployers.ds.processors.DsXmlDeploymentInstallProcessor.deploy(DsXmlDeploymentInstallProcessor.java:138)

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

              ... 5 more

            Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.data-source.java:jboss/datasources/MyWorkbenchDS is already registered

              at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:154) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

              at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:227) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

              at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:561) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

              at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

              at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

              at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

              at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

              at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:307) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]

              at org.jboss.as.connector.deployers.ds.processors.DsXmlDeploymentInstallProcessor.startDataSource(DsXmlDeploymentInstallProcessor.java:326)

              at org.jboss.as.connector.deployers.ds.processors.DsXmlDeploymentInstallProcessor.deploy(DsXmlDeploymentInstallProcessor.java:135)

              ... 6 more

             

             

            10:30:04,687 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 26) JBAS018559: Deployed "MyWorkbench.war" (runtime-name : "MyWorkbench.war")

            10:30:04,691 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report

            JBAS014777:   Services which failed to start:      service jboss.deployment.unit."MyWorkbench.war".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."MyWorkbench.war".FIRST_MODULE_USE: JBAS018733: Failed to process phase FIRST_MODULE_USE of deployment "MyWorkbench.war"

             

            10:30:04,718 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management

            10:30:04,722 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990

            10:30:04,722 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: JBoss EAP 6.1.0.GA (AS 7.2.0.Final-redhat-8) started (with errors) in 5764ms - Started 136 of 194 services (1 services failed or missing dependencies, 55 services are passive or on-demand)

             

            ==============================================

             

            Persistent.xml:

             

            <persistence version="2.0"

               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_2_0.xsd">

               <persistence-unit name="primary">

                  <!-- If you are running in a production environment, add a managed

                     data source, this example data source is just for development and testing! -->

                  <!-- The datasource is deployed as WEB-INF/MyWorkbench-ds.xml, you

                     can find it in the source at src/main/webapp/WEB-INF/MyWorkbench-ds.xml -->

                  <jta-data-source>java:jboss/datasources/MyWorkbenchDS</jta-data-source>

                  <properties>

                     <!-- Properties for Hibernate -->

                     <property name="hibernate.hbm2ddl.auto" value="create-drop" />

                     <property name="hibernate.show_sql" value="false" />

              <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />

                  </properties>

               </persistence-unit>

            </persistence>

             

            =================================================

            It seems to have a problem when it reads the persistence.xml file in my project.

             

            Regards,

             

            -Rob