4 Replies Latest reply on Sep 14, 2007 9:31 AM by Yiping Zhao

    java.lang.ClassCastException: org.jnp.interfaces.NamingConte

    Yiping Zhao Newbie

      Hi,

      I have an ejb2.0 sessionbean and ejb3.0 pojos, the sessionbean is defined in ejb-jar.xml along with persistence-context-ref and persistence-unit-ref.

      In the client, it will look up the sessionbean by jndi look up "test-client/ejb/TestRunner" to create the sessionbean to operate entity. Now I have a problem in the jndi look up, "test-client" is the "display-name" in application-client.xml, "ejb/TestRunner" is the "ejb-ref-name" in application-client.xml, and I see "Global JNDI Namingspace" in jmx-console is:

      +- test-client (class: org.jnp.interfaces.NamingContext)
      | +- ejb (class: org.jnp.interfaces.NamingContext)
      | | +- TestRunner[link -> TestRunnerBean] (class: javax.naming.LinkRef)

      See the look up string is exactly matching the one displayed in Global JNDI Namingspace, but I got exception. I saw bunch of posts talking about the ClassCastException, but it seems none of them is related to my case, does anyone have idea about this?


      Thanks.

        • 1. Re: java.lang.ClassCastException: org.jnp.interfaces.NamingC
          jaikiran pai Master

           

          in application-client.xml, "ejb/TestRunner" is the "ejb-ref-name"


          Did you try looking up using

          ctx.lookup("ejb/TestRunner");


          • 2. Re: java.lang.ClassCastException: org.jnp.interfaces.NamingC
            Yiping Zhao Newbie

            I tried it already, if i look up like ctx.loopup("ejb/TestRunner"), I will get:

            javax.naming.NameNotFoundException: ejb not bound

            • 4. Re: java.lang.ClassCastException: org.jnp.interfaces.NamingC
              Yiping Zhao Newbie

              The exception I got is:

              javax.naming.NameNotFoundException: ejb not bound
              at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
              at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
              at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
              at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
              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:627)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
              at javax.naming.InitialContext.lookup(InitialContext.java:351)
              at oracle.toplink.testing.tests.internal.ejb.ServerTestCase.runBareClient(ServerTestCase.java:67)
              at oracle.toplink.testing.tests.internal.ejb.ServerTestCase.runBare(ServerTestCase.java:39)