1

I'm developing a simple aplication that must have access to an Oracle 10g DB and that is running under a JBoss EAP 6.1.0 server. I have followed the steps given on the official guide in order to install the Oracle driver.

So currently, I have the following config files. I added folder jboss-eap-6.1\modules\com\oracle\db\main with ojdbc6.jar and module.xml, with content:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.oracle.db">
  <resources>
    <resource-root path="ojdbc6.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
  </dependencies>
</module>

In jboss-eap-6.1\standalone\configuration\standalone.xml I added the following lines in the datasources node:

        <datasource jndi-name="java:/jdbc/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true">
            <connection-url>jdbc:oracle:thin:@10.0.6.0:1521:ORC1;DB_CLOSE_DELAY=-1</connection-url>
            <driver>oracle</driver>
            <security>
                <user-name>a</user-name>
                <password>a</password>
            </security>
        </datasource>
        <drivers>
            <driver name="oracle" module="com.oracle.db">
                <datasource-class>oracle.jdbc.driver.OracleDriver</datasource-class>
            </driver>
        </drivers>

And finally, in my Java code I create the connection with:

InitialContext initContext = new InitialContext();
DataSource ds = (DataSource)initContext.lookup("java:/jdbc/OracleDS");
conexion = ds.getConnection();

While executing this, it gives me an error on the line conexion = ds.getConnection():

javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/jdbc/OracleDS

I've been looking for a possible solution on the net with no success. Any idea?

Alex Poole
  • 183,384
  • 11
  • 179
  • 318
  • Can you confirm that you have a JNDI entry `java:/jdbc/OracleDS'? Also, can you telnet to 10.0.6.0 port 1521 (this IP looks suspect to me...a '0' as the last octet????)? You should test the connectivity from your Application server to make sure there are no strange firewall/routing issues. – CodeChimp Dec 20 '13 at 12:39
  • The JNDI entry is defined in the file 'standalone.xml' (mentioned in my post). Should it be defined in another file? And connectivity is ok, yeah, with '0' as the last octet (local IP, just for testing). – Josep A. Perales Dec 20 '13 at 12:51
  • What I am asking is can you confirm in JNDI directly that the name exists? I believe JBoss has a page or something that you can go to that gives a dump of all the JNDI registered names. Since you mentioned this is local testing, could you also try changing the IP to '127.0.0.1' as well? You didn't say whether this is Windows or *nix, but a lot of *nix-based applications have a tendency to bind to localhost by default. – CodeChimp Dec 20 '13 at 12:57
  • Sorry, IP corresponds to local network, not local PC, so it must be like this. Regarding JNDI registered names, I have executed: [standalone@localhost:9999 /] /subsystem=naming:jndi-view and in the output appears `code` "jdbc" => { "class-name" => "javax.naming.Context", "children" => {"OracleDS" => { "class-name" => "org.jboss.jca.adapters.jdbc.WrapperData Source", "value" => "org.jboss.jca.adapters.jdbc.WrapperDataSourc e@1c9833d" }} in "java: contexts". – Josep A. Perales Dec 20 '13 at 13:22
  • So, from your test box, can you do a `telnet 10.0.6.0 1521`? If you don't get something about "Connected, press Ctrl-[ to end", then we can narrow it down to connectivity. Also, my curiosity about your IP address is that the .0 and .1 are usually reserved for default gateways. They don't *have* to be, but that's usually the case. Strange when I see a non-Gateway device with either of those IPs. – CodeChimp Dec 20 '13 at 17:25
  • Excuse me for the delay. Tested and it can connect correctly to this IP, so I guess is something related to the Java invocation (due to the fact JBoss resolves properly the JNDI names, as seen executing jndi-view). I think it should be easier, just for connecting a JBoss server to an Oracle DB.. Thanks for helping! – Josep A. Perales Dec 23 '13 at 07:58

1 Answers1

0

Finally, I could make it work! What I've done:

  • In standalone.xml, I've changed those two lines:

-

<datasource jndi-name="java:/jdbc/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:oracle:thin:@10.0.6.0:1521:ORC1;DB_CLOSE_DELAY=-1</connection-url>

for

<datasource jndi-name="**java:jboss/OracleDS**" pool-name="OracleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:oracle:thin:**@//10.0.0.110:1521/orc11.palluc.com**</connection-url>

so my jndi-name and url connection were invalid.

  • In Java code, I've changed (taking into account previous changes):

    DataSource ds = (DataSource)initContext.lookup("java:/jdbc/OracleDS");

for

DataSource ds = (DataSource)initContext.lookup("java:jboss/OracleDS");

After that, it seemed to work but I still got the Oracle error explained in ORA-01882: timezone region not found . I followed comment #6 to solve it (it seems there are 'prettier' solutions than directly modifying ojdbc6.jar library, as explained in this post), and now it works as expected.

Community
  • 1
  • 1