[jboss-user] [JNDI/Naming/Network] - Problem with JNDI/lookup

stepec do-not-reply at jboss.com
Wed Feb 21 11:19:32 EST 2007

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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4020043#4020043

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4020043

More information about the jboss-user mailing list