Unable to get managed connection for jdbc

Hi 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 Unable to get managed connection for jdbc (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

 

 

 

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

Master

3,092 发帖自
2001-10-9

当前正在审批
1. 2011-4-28 下午2:25 ( 回复 titang)
Unable to get managed connection for jdbc

The datasource is normaly reachable under 'java:'

You should use lookup("java:jdbc/test").

But I'm not sure whether jdbc/test works, if not try jdbcTest to check it.


2001-10-9

当前正在审批
3. 2011-4-29 上午6:26 ( 回复 titang)
Unable to get managed connection for jdbc

I meant you should use a simple JNDI name without '/'.

<jndi-name>MyJDBCTest</jndi-name>

You should remove the 'use-java-context' element, I do not need it.

this lookup should work:

initialContext.lookup("java:MyJDBCTest");

If you have problems please attach the error log message.

Also I would recommend to use a newer ojdbc implementation, the ojdbc6.jar require a Java6 runtime environment.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值