<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Unable to get managed connection for jdbc
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/titang">titang</a> in <i>Datasource Configuration</i> - <a href="http://community.jboss.org/message/602594#602594">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi everybody,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p> So I am having the following exceptions when I try to deploy my application:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p> ERROR <a class="jive-link-external-small" href="org.rhq.core.pc.inventory.InventoryManager">org.rhq.core.pc.inventory.InventoryManager</a> 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 <a class="jive-link-external-small" href="org.rhq.plugins.jbossas5.serviceBinding.ManagerComponent.getAvailability()">org.rhq.plugins.jbossas5.serviceBinding.ManagerComponent.getAvailability()</a> with args [] timed out. Invocation thread will be interrupted</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>2011-04-28 18:09:01,309 ERROR <a class="" href="http://community.jboss.org/message/602594#602594">Unable to get managed connection for jdbc</a> (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)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p> The second error appears when I use this code:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-java">DataSource ds = (DataSource)((Context)(<font color="navy"><b>new</b></font> InitialContext()).lookup(<font color="red">"java:/comp/env"</font>)).lookup(<font color="red">"jdbc/test"</font>);
&#160;
<font color="navy"><b>final</b></font> Connection conn = ds.getConnection();
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>In order to declare my data source (an Oracle 10g database), I used the following files:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>oracle-ds.xml:</p><pre class="jive-pre"><code class="jive-code jive-xml"> <span class="jive-xml-tag">&lt;datasources&gt;</span>

&#160; <span class="jive-xml-tag">&lt;local-tx-datasource&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;jndi-name&gt;</span>jdbc/test<span class="jive-xml-tag">&lt;/jndi-name&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;use-java-context&gt;</span>false<span class="jive-xml-tag">&lt;/use-java-context&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;connection-url&gt;</span>jdbc:oracle:thin:@test-oracle:1521:test<span class="jive-xml-tag">&lt;/connection-url&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-comment"><span>&lt;!--

&#160;&#160;&#160;&#160;&#160;&#160;&#160; Here are a couple of the possible OCI configurations.
&#160;&#160;&#160;&#160;&#160;&#160;&#160; For more information, see </span><a class="jive-link-external-small" href="http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm" target="_blank">http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm</a><span>

&#160;&#160;&#160; </span><span class="jive-xml-tag">&lt;connection-url&gt;</span>jdbc:oracle:oci:@youroracle-tns-name<span class="jive-xml-tag">&lt;/connection-url&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; or
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;connection-url&gt;</span>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))<span class="jive-xml-tag">&lt;/connection-url&gt;</span>

&#160;&#160;&#160;&#160;&#160;&#160;&#160; Clearly, its better to have TNS set up properly.
&#160;&#160;&#160;&#160; --&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;min-pool-size&gt;</span>5<span class="jive-xml-tag">&lt;/min-pool-size&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;max-pool-size&gt;</span>100<span class="jive-xml-tag">&lt;/max-pool-size&gt;</span>

&#160;&#160;&#160; <span class="jive-xml-tag">&lt;driver-class&gt;</span>oracle.jdbc.OracleDriver<span class="jive-xml-tag">&lt;/driver-class&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;user-name&gt;</span>test<span class="jive-xml-tag">&lt;/user-name&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;password&gt;</span>test<span class="jive-xml-tag">&lt;/password&gt;</span>

&#160;&#160;&#160; <span class="jive-xml-tag">&lt;exception-sorter-class-name&gt;</span>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter<span class="jive-xml-tag">&lt;/exception-sorter-class-name&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;metadata&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;type-mapping&gt;</span>Oracle9i<span class="jive-xml-tag">&lt;/type-mapping&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/metadata&gt;</span>
&#160; <span class="jive-xml-tag">&lt;/local-tx-datasource&gt;</span>

<span class="jive-xml-tag">&lt;/datasources&gt;</span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>jboss-web.xml:</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;jboss-web&gt;</span>

&#160; <span class="jive-xml-comment">&lt;!-- A security domain that restricts access
&#160; <span class="jive-xml-tag">&lt;security-domain&gt;</span>java:/jaas/JBossWS<span class="jive-xml-tag">&lt;/security-domain&gt;</span>
&#160; --&gt;</span>

&#160;&#160;&#160; <span class="jive-xml-tag">&lt;context-root&gt;</span>test<span class="jive-xml-tag">&lt;/context-root&gt;</span>

&#160;&#160;&#160; <span class="jive-xml-tag">&lt;resource-ref&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;res-ref-name&gt;</span>jdbc/test<span class="jive-xml-tag">&lt;/res-ref-name&gt;</span> 
&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;!--res-type&gt;javax.sql.DataSource<span class="jive-xml-tag">&lt;/res-type--&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;jndi-name&gt;</span>jdbc/test<span class="jive-xml-tag">&lt;/jndi-name&gt;</span>&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/resource-ref&gt;</span>
<span class="jive-xml-tag">&lt;/jboss-web&gt;</span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>web.xml:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;resource-ref&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;description&gt;</span>Oracle data source<span class="jive-xml-tag">&lt;/description&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;res-ref-name&gt;</span>jdbc/test<span class="jive-xml-tag">&lt;/res-ref-name&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;res-type&gt;</span>javax.sql.DataSource<span class="jive-xml-tag">&lt;/res-type&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;res-auth&gt;</span>Container<span class="jive-xml-tag">&lt;/res-auth&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;res-sharing-scope&gt;</span>Unshareable<span class="jive-xml-tag">&lt;/res-sharing-scope&gt;</span>
&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/resource-ref&gt;</span>
</code></pre><p>No other resources are declared. The oracle datasource is up in the admin-console. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/602594#602594">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Datasource Configuration at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>