0 Replies Latest reply on Sep 17, 2006 12:16 PM by pmoreau

    NotContextException while lookup remote stateless EJB 3.0

    pmoreau

      I am trying to migrate EJB 2.0 application to EJB 3.0.
      Deployment on Jboss server 4.0.4GA whith EJB3 configuration seems OK

      But when running my EJB 3.0 client code, I get these exception :*


      Failed
      javax.naming.NotContextException

      at org.jnp.server.NamingServer.lookup(NamingServer.java:285)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
      at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
      at java.lang.Thread.run(Thread.java:595)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at RemoteCalcTest.main(RemoteCalcTest.java:38)


      As I thought having done something wrong, I tried again with the Trailblazer demo with this simple client code :
       public static void main(String[] args) {
       try {
       InitialContext ctx = new InitialContext();
       ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       ctx.addToEnvironment(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
       ctx.addToEnvironment(Context.PROVIDER_URL,"localhost");
       RemoteCalculator cal = (RemoteCalculator) ctx.lookup(
       "EJB3Trail/RemoteCalculator/remote");
       double res = cal.calculate(10, 80, 0.05 , 100);
       System.out.println ("Resultat = " + res);
       } catch (Exception e) {
       System.out.println ("Failed");
       e.printStackTrace();
       }
      


      I am running jdk 1.5.0_08 (tried also 07...) and have the following classpath in my Jboss IDE 2.0 project:

      <classpath>
       <classpathentry kind="src" path="src"/>
       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
       <classpathentry kind="var" path="JBOSS40/client/jboss-ejb3-client.jar"/>
       <classpathentry kind="var" path="JBOSS40/client/jnp-client.jar"/>
       <classpathentry kind="var" path="JBOSS40/client/commons-logging.jar"/>
       <classpathentry kind="var" path="JBOSS40/client/jboss-common-client.jar"/>
       <classpathentry kind="output" path="bin"/>
      </classpath>
      


      Trailblazer web application work fine, but I still get the NotContextException with the remote client.

      Is something wrong or am I facing a bug?

      Thanks for help...