2 Replies Latest reply on Apr 4, 2006 8:45 AM by Stefan Frank

    NotContextException when looking up an EJB

    Stefan Frank Newbie

      Hi,

      i have a very strange Exception when i try to:

      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "localhost:1099");
      env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      InitialContext lContext = new InitialContext(env);

      projectHome = (ProjectSessionHome)ctx.lookup(ProjectSessionHome.JNDI_NAME);

      This code bangs with a:
      javax.naming.NotContextException
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:597)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at de.dkfz.ibios.ome.tests.ProjectsTest.testProjectSessionLookup(ProjectsTest.java:48)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at com.intellij.rt.execution.junit2.JUnitStarter.main(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at com.intellij.rt.execution.application.AppMain.main(Unknown Source)

      Process terminated with exit code -1

      Has anybody seen this error before?! The code has been working formerly but I cannot reconstruct what exactly I have changed (The latest I can remember is changing the Classpath to include some new Classes)