1 Reply Latest reply on Mar 30, 2013 12:23 PM by Sam C

    IJ000453: Unable to get managed connection for java:jboss/datasources/<DataSource>

    Sam C Newbie

      I am trying to setup JBOSS connection to postgres, connection details below, but get an error where it is failing to connect. Any ideas what needs to be done? i am new to JBoss and Postgres. I got data in my STOCK schema but cannot figure out why it cannot make a connection when I go to the webpage localhost:8080/example

       

      This is a very simple app and does nothing exciting other then authenticate.

       

      web.xml contains the following with some other stuff but this is the authentication

        <login-config>

             <auth-method>BASIC</auth-method>

             <realm-name>Stock</realm-name>

        </login-config>

       

      Stock-ds.xml (Found in deployments directory)

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

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

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

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

        <connection-url>jdbc:postgresql://localhost:5432/postgres</connection-url>

        <driver>postgresql-8.4-703.jdbc4.jar</driver>

        <pool></pool>

        <security>

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

         <password>password</password>

        </security>

      </datasource>

      </datasources>

       

      standalone.xml

                  <security-domain name="Stock" cache-type="default">
                      <authentication>
                          <login-module code="Database" flag="required">
                              <module-option name="dsJndiName" value="java:jboss/datasources/StockDatasource"/>
                              <module-option name="principalsQuery" value="select password from STOCK.USER where username=?"/>
                              <module-option name="rolesQuery" value="select rolename, 'Roles' from STOCK.ROLE r, STOCK.USER u where u.userid=r.userid and u.username=?"/>
                          </login-module>
                      </authentication>
                  </security-domain>

       

      The error i get is:

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

          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)

          ... 29 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:371)

          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)

          ... 32 more

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

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

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

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

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

          ... 35 more

      Caused by: org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user "postgres"