views:

186

answers:

0

Hello

I'm using Oracle 10.2.0.4 server and we are testing Java Application Servers in order to chose the most appropriate for our needs. So far we managed to get OpenEJB and GlassFish working, but not JBoss.

We have a simple fat Java client connecting to a simple EJB 3.0 (stateless session bean), which in turn, tries to perform a simple SQL query using an oracle data source. This same setup has already worked with Apache's OpenEJB and Sun's Glashfish. However, we couldn't make it work with either Jboss 5.1.0.GA or Jboss-6.0.0.20100721-M4 (the latest milestone).

Jboss deploys the EJB without errors and the EJB can indeed be reached by the client. However, when the EJB tries to get a connection from the Oracle data source it fails with:

11:04:34,837 INFO  [STDOUT] oracleDS=org.jboss.resource.adapter.jdbc.WrapperDataSource@63d587bf
11:04:45,110 WARN  [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: I/O Exception: The Network Adapter could not establish the connection)
            at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:225) [:6.0.0.20100721-M4]
            at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:195) [:6.0.0.20100721-M4]
            at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:643) [:6.0.0.20100721-M4]
            at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:267) [:6.0.0.20100721-M4]
            at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:747) [:6.0.0.20100721-M4]
            at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:403) [:6.0.0.20100721-M4]
            at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:413) [:6.0.0.20100721-M4]
            at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496) [:6.0.0.20100721-M4]
            at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941) [:6.0.0.20100721-M4]
            at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89) [:6.0.0.20100721-M4]
            at test.ejb.Business.getResults(Business.java:184) [:]

The data source configuration file oracle-ds.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
    <local-tx-datasource>
        <jndi-name>oracleDS</jndi-name>
        <connection-url>jdbc:oracle:thin:@192.168.10.20:1521:ODB</connection-url>
        <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
        <user-name>myusername</user-name>
        <password>mypassword</password>
        <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
        <metadata>
            <type-mapping>Oracle9i</type-mapping>
        </metadata>
      <min-pool-size>0</min-pool-size>
      <max-pool-size>20</max-pool-size>
      <idle-timeout-minutes>0</idle-timeout-minutes>
      </local-tx-datasource>
</datasources>

The relevant parts of the EJB are:

@Stateless
public class Business implements BusinessRemote {

@Resource(name = "oracleDS",mappedName="java:oracleDS")
private DataSource oracleDS;

public String validateEJB(String value) {
    return value + "ok";
}

public String[] getResults() {

    String[] result = null;

    Connection con = null;
    Statement st = null;
    ResultSet rs = null;

    try {
                //Fails here
        con = oracleDS.getConnection();

I have already played with different values for the @Resource tag, different Oracle JDBC drivers (currently we are using ojdbc14.jar and orai18n.jar. The connection works either directly or through OpenEJB.

Does anybody have a hint of what might be wrong? Thanks