use InitialContext error


EJB programming & troubleshooting: use InitialContext error

  1. use InitialContext error (2 messages)

    I want to use datasource, the code is right in jdk1.3 command line prompt, but it always throw Exception
    in VAJ, java.naming.* is in classpath

    InitialContext ctx = null;
    Properties props = new Properties();
    props.put(javax.naming.Context.PROVIDER_URL, "iiop:///");
    props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "");
    ctx = new InitialContext(props);
    DataSource dataSource = (DataSource)ctx.lookup("jdbc/tup");
    Connection jdbcConn = dataSource.getConnection("tup","123");
    catch(Exception e){

    I don not know why

    Threaded Messages (2)

  2. use InitialContext error[ Go to top ]

    I think in VAJ you need to start Naming server. Try that and it should work.
  3. use InitialContext error[ Go to top ]

    Do a "check classpath" on your class, then add the "IBM WebSphere Test Environment" and "IBM Enterprise Libraries" projects to your classpath. As "" is a string, VAJ does not identify the reference and does not add the two required projects to your classpath.