JNDIDataSource with JBoss

From: Tore Halset (halse..vv.ntnu.no)
Date: Thu Sep 18 2003 - 03:32:05 EDT

  • Next message: Andrus Adamchik: "Re: Some parts of FK are missing"

    Hello.

    I have mailed about the issue before, but it did not lead to anything.
    Later on I developed a workaround that is working for me.

    The datasource defenition in JBoss looks like:
    <datasources>
      <local-tx-datasource>
        <jndi-name>myappDS</jndi-name>
        <connection-url>jdbc:postgresql://...</connection-url>
        <driver-class>org.postgresql.Driver</driver-class>
        <user-name>username</user-name>
        <password>password</password>
      </local-tx-datasource>
    </datasources>

    The following change in JNDIDataSourceFactory made it work:
    /* original code
    Context envCtx = (Context) initCtx.lookup("java:comp/env");

    if (envCtx == null) {
      logObj.log(logLevel, "warning: java:comp/env context is null.");
    }

    DataSource ds = (DataSource) envCtx.lookup(location);
    */
    DataSource ds = (DataSource) initCtx.lookup(location);

    Any comments? Am I doing something wrong? It is working for me with this
    fix.

     - Tore.



    This archive was generated by hypermail 2.0.0 : Thu Sep 18 2003 - 03:27:15 EDT