Cannot instantiate class: weblogic.jndi.WLInititialContext - Weblogic

This is a discussion on Cannot instantiate class: weblogic.jndi.WLInititialContext - Weblogic ; I am trying to run a very simple java application.I have installed weblogic 7.0. I have included weblogic.jar in my classpath. The error is being caused by the code Hashtable ht=new Hashtable(); ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); ht.put(Context.PROVIDER_URL,"t3://localhost:7001"); //Get a Context for the JNDI ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Cannot instantiate class: weblogic.jndi.WLInititialContext

  1. Cannot instantiate class: weblogic.jndi.WLInititialContext

    I am trying to run a very simple java application.I have installed weblogic 7.0.
    I have included weblogic.jar in my classpath.

    The error is being caused by the code
    Hashtable ht=new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    ht.put(Context.PROVIDER_URL,"t3://localhost:7001");

    //Get a Context for the JNDI lookup

    ctx=new InitialContext(ht);

    javax.sql.DataSource ds=(javax.sql.DataSource)ctx.lookup("JWSPoolDataSource");
    conn=ds.getConnection();

    System.out.println("Making a Connection ..");

    //Execute SQL statements

    stmt=conn.createStatement();

    Any help will be greatly appreciated

  2. Re: Cannot instantiate class: weblogic.jndi.WLInititialContext


    Hi there,

    I see nothing wrong in your code. Have you tried using weblogic.jndi.Environment
    instead. I assume by trying to set such properties, you are trying to connect
    to WLS from a remote machine.

    Thanks,

    -RT



    pradyot wrote:
    >I am trying to run a very simple java application.I have installed weblogic
    >7.0.
    >I have included weblogic.jar in my classpath.
    >
    >The error is being caused by the code
    >Hashtable ht=new Hashtable();
    > ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    > ht.put(Context.PROVIDER_URL,"t3://localhost:7001");
    >
    > //Get a Context for the JNDI lookup
    >
    > ctx=new InitialContext(ht);
    >
    > javax.sql.DataSource ds=(javax.sql.DataSource)ctx.lookup("JWSPoolDataSource");
    > conn=ds.getConnection();
    >
    > System.out.println("Making a Connection ..");
    >
    > //Execute SQL statements
    >
    > stmt=conn.createStatement();
    >
    >Any help will be greatly appreciated



+ Reply to Thread