1 Reply Latest reply on Feb 27, 2007 9:50 AM by Pavel Stepanek

    Problem with JNDI/lookup

    Pavel Stepanek Newbie

      Hello,
      I´m learning EJB3 form Mastering EJB3 book. I wrote the session bean, deploy it on JBoss, which says me that JNDI name is "CounterBean".

      When coding the client there are these lines:

      //gaining initial context - is OK
      //and now the critical line:

      Counter counter = (Counter) ctx.lookup("CounterBean");

      this lines causes ClassCastException: org.jnp.interfaces.NamingContext

      I don´t understand when it is necessary to use the call with PortableRemoteObject.narrow() and when the lookup returns the instance.

      In bean class, there is annotation @Remote(Counter.class) so I suppose it is remote object. I also tried this name: "CounterBean/remote" but I got this exception:
      java.lang.NoclassDefFoundError: org/jboss/util/thread/ThreadPool

      Can anyone help me with running this simple but also tough example? :)

      I would also like to know which jar files I need to add to project (Netbeans) e.g. jbossall-client.jar ...