Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    8

    Cool Unanswered: DataSource Problem

    Hi all,
    I am trying to access my database using a DataSource but I am encountering a problem and have tried in vain to find a solution(code snipet and stacktrace given below). I am using websphere application server and the database is Oracle 9i. I the server running. Any help would be greatly appreciated.

    Thanks

    String dsName1 = "jdbc/UpaidPool"; // JNDI name
    DataSource ds1 = null;
    Connection conn = null;

    /**
    * Construct an access object.
    */
    public access ()
    {
    try
    {
    Context ctx = new InitialContext();
    ds1 = (DataSource)ctx.lookup(dsName1); // Problem here

    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(N amingManager.java:647)
    at javax.naming.InitialContext.getDefaultInitCtx(Init ialContext.java:247)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx (InitialContext.java:284)
    at javax.naming.InitialContext.lookup(InitialContext. java:351)
    at access.<init>(access.java:19)
    at access.main(access.java:58)
    java.lang.NullPointerException
    at access.performread(access.java:34)
    at access.main(access.java:59)
    Exception in thread "main" Process terminated with exit code 1

  2. #2
    Join Date
    Jan 2004
    Posts
    8
    I have added the appropriate jar files to my classpath and tnow the error seems to have migrated to the DataSource as opposed to the Initial Context. I now get a different error (Stack trace below). Any Ideas?

    com.ibm.websphere.naming.CannotInstantiateObjectEx ception: Exception occurred wh
    ile the JNDI NamingManager was processing a javax.naming.Reference object. Root
    exception is javax.naming.NamingException: ClassNotFoundException: oracle.jdbc.
    pool.OracleConnectionPoolDataSource
    at com.ibm.websphere.advanced.cm.factory.DataSourceFa ctory$ResourceRefer
    enceObjectFactory.getObjectInstance(DataSourceFact ory.java:705)
    at javax.naming.spi.NamingManager.getObjectInstance(N amingManager.java:3
    08)
    at com.ibm.ws.naming.util.Helpers.processSerializedOb jectForLookup(Helpe
    rs.java:737)
    at com.ibm.ejs.ns.jndi.CNContextImpl.processResolveRe sults(CNContextImpl
    .java:1594)
    at com.ibm.ejs.ns.jndi.CNContextImpl.doLookup(CNConte xtImpl.java:1470)
    at com.ibm.ejs.ns.jndi.CNContextImpl.lookup(CNContext Impl.java:1120)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCt x.java:128)
    at javax.naming.InitialContext.lookup(InitialContext. java:351)
    at access.<init>(access.java:25)
    at access.main(access.java:64)
    Exception in thread "P=343:O=0:CT" java.lang.NullPointerException
    at access.performread(access.java:40)
    at access.main(access.java:65)

  3. #3
    Join Date
    Feb 2004
    Posts
    1
    Reading the stacktrace :

    ClassNotFoundException: oracle.jdbc.pool.OracleConnectionPoolDataSource

    Check if this class (included in classes12.jar) is in your WAS classpath.

    Hope this helps.

    --
    David
    Last edited by dmol; 02-06-04 at 05:46.

  4. #4
    Join Date
    Jan 2004
    Posts
    8
    Thanks I'm just reinstalling websphere because it didn't seem to be working properly and hopefully that will sort it out

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •