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

    Problem with JNDI/lookup

    stepec

      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 ...

        • 1. Re: Problem with JNDI/lookup
          stepec

          for those who may get in this situation, the problem solution is to add JAR libraries to project and it works.

          I don´t know why this is so messy at JBOSS. Why there is no single JAR, why I have to search the whole JBOSS dir for classes I´m missing? Damn god ...