Unable to get managed connection for jdbc
titang Apr 28, 2011 12:41 PMHi everybody,
I have been searching how to solve my problem but I can't find any solution. I am quite sure I must have forgotten something but I don't know what. So I guess I need some help unfortunaltely.
So I am having the following exceptions when I try to deploy my application:
ERROR [org.rhq.core.pc.inventory.InventoryManager] Call to getAvailablity() on ResourceComponent for Resource[id=-49, type=Service Binding Manager, key=ServiceBindingManager, name=Service Binding Manager, parent=JBoss AS 6 (default)] failed.: org.rhq.core.pc.inventory.TimeoutException: Call to [org.rhq.plugins.jbossas5.serviceBinding.ManagerComponent.getAvailability()] with args [] timed out. Invocation thread will be interrupted
2011-04-28 18:09:01,309 ERROR [STDERR] (ResourceContainer.invoker.nonDaemon-1) org.jboss.util.NestedSQLException: Unable to get managed connection for jdbc/test; - nested throwable: (javax.resource.ResourceException: Unable to get managed connection for jdbc/test)
I am focusing on the second error but the first one may be the cause of the SQL Exception. I could not find any information on the first exception and have absolutely no idea which part of my app raises this exception.
The second error appears when I use this code:
DataSource ds = (DataSource)((Context)(new InitialContext()).lookup("java:/comp/env")).lookup("jdbc/test"); final Connection conn = ds.getConnection();
In order to declare my data source (an Oracle 10g database), I used the following files:
oracle-ds.xml:
<datasources> <local-tx-datasource> <jndi-name>jdbc/test</jndi-name> <use-java-context>false</use-java-context> <connection-url>jdbc:oracle:thin:@test-oracle:1521:test</connection-url> <!-- Here are a couple of the possible OCI configurations. For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm <connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url> or <connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url> Clearly, its better to have TNS set up properly. --> <min-pool-size>5</min-pool-size> <max-pool-size>100</max-pool-size> <driver-class>oracle.jdbc.OracleDriver</driver-class> <user-name>test</user-name> <password>test</password> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name> <metadata> <type-mapping>Oracle9i</type-mapping> </metadata> </local-tx-datasource> </datasources>
jboss-web.xml:
<jboss-web> <!-- A security domain that restricts access <security-domain>java:/jaas/JBossWS</security-domain> --> <context-root>test</context-root> <resource-ref> <res-ref-name>jdbc/test</res-ref-name> <!--res-type>javax.sql.DataSource</res-type--> <jndi-name>jdbc/test</jndi-name> </resource-ref> </jboss-web>
web.xml:
<resource-ref> <description>Oracle data source</description> <res-ref-name>jdbc/test</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Unshareable</res-sharing-scope> </resource-ref>
No other resources are declared. The oracle datasource is up in the admin-console.
If you have any idea, thank you. If there are any informations lacking, tell me, I will add them as soon as possible. Thank you