File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes simple jndi question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "simple jndi question" Watch "simple jndi question" New topic

simple jndi question

Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
i'm new to this topic. i try to write a client application for jboss, an easy helloWorld.

my directory strukture:

question 1:
do i have to put the interfaces into a HelloWorldClient.jar to run the client? i thought i dont have to, because of jndi. Must I always import the interfaces? or is there a other better way?
question 2:
my client doesn't work, what means the exception:
java.lang.NoClassDefFoundError: org/jboss/logging/Logger
at org.jnp.interfaces.NamingContext.<clinit>(
at org.jnp.interfaces.NamingContextFactory.getInitialContext(
at javax.naming.spi.NamingManager.getInitialContext(
at javax.naming.InitialContext.getDefaultInitCtx(
at javax.naming.InitialContext.init(
at javax.naming.InitialContext.<init>(
at HelloWorldClient.main(
Exception in thread "main" Process terminated with exit code 1
question 3:
Context.lookup must have the name of the jar-file as param?
please help, thanks a lot

regards kay
[ January 08, 2003: Message edited by: Kay Tracid ]
Greg Charles

Joined: Oct 01, 2001
Posts: 2968

Question 1:
Yes, your client needs to have the interfaces, both HelloWorldHome and HelloWorldRemote, to work. In fact, you won't even be able to compile the client without access to those interfaces. Because of the underlying RMI mechanism, you don't need the stub classes that implement those interfaces. Those will be delivered to your client at runtime, but you do need the interfaces.
Question 2:
No idea. It looks to be JBoss specific. I would check to make sure JBoss's logger is in the classpath of the server. I don't think you will need it for the client, but I don't know for sure.
Question 3:
Context.lookup doesn't need the name of the Jar file as a parameter. It needs the JNDI name of the bound object, which is an object that implements HelloWorldHome. The class of this object is automatically generated during the EJB compile (ejbc). You specify the JNDI name in your deployment descriptor. It may be the same name as the Jar file, but then again, it may not.
Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
Thanks a lot. You're a great help.
I found an answer for question 2 here
[ January 08, 2003: Message edited by: Kay Tracid ]
I agree. Here's the link:
subject: simple jndi question
It's not a secret anymore!