I have some Java code written by someone else (long gone, no way to contact them) running on a JBoss server that I'm debugging. It's getting a javax.sql.DataSource
with this one line of code:
DataSource ds = new InitialContext().lookup("java:/jdbc/WPDS");
However, when they use ds.getConnection()
on the next line, this shows up in the logs:
...
javax.resource.ResourceException: Unable to get managed connection for jdbc/WPDS
...
Caused by: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: ORA-01017: invalid username/password; logon denied)
I've looked around and found a file named oracle-xa-ds.xml
. It contains this:
<datasources>
<xa-datasource>
<jndi-name>jdbc/WPDS</jndi-name>
<!-- uncomment to enable interleaving <interleaving/> -->
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
<xa-datasource-property name="URL">jdbc:oracle:thin:@hostname.hidden.com:1621:HIDE</xa-datasource-property>
<xa-datasource-property name="User">hidden</xa-datasource-property>
<xa-datasource-property name="Password">hidden</xa-datasource-property>
<!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
<!-- Checks the Oracle error codes and messages for fatal errors -->
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<!-- Oracles XA datasource cannot reuse a connection outside a transaction once enlisted in a global transaction and vice-versa -->
<no-tx-separate-pools/>
<max-pool-size>50</max-pool-size>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</xa-datasource>
<mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"
name="jboss.jca:service=OracleXAExceptionFormatter">
<depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
</mbean>
</datasources>
I've verified that all these settings are right. I can connect to the database using the hostname, port, SID, username, and password given in this file.
I suspect that maybe it's loading the DataSource
from somewhere else, but I don't know how I could check that theory (and if it's true, how would I find out where it's actually getting it from?) Is there some kind of JNDI logging I can enable, or maybe I can somehow get it to tell me what username/password it's trying to use (so I can see if it's using what's in the file or not?)
jdbc/WPDS
with typeXA Datasource
and statusUP
. I can verify it is loading from this file, because it initially said thatAvailable Connection Count
was 50 (as it is in the file in my original post), and when I changed the file to have 60 and restarted the server, it followed accordingly. – ArtOfWarfare