wood burning stoves 2.0*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "simple jndi question" Watch "simple jndi question" New topic
Author

simple jndi question

Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
hi,
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>(NamingContext.java:92)
at org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingContextFactory.java:42)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at HelloWorldClient.main(HelloWorldClient.java:16)
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
Sheriff

Joined: Oct 01, 2001
Posts: 2849
    
  11

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
http://www.coderanch.com/t/88097/JBoss/jboss-org-jboss-logging-Logger
[ January 08, 2003: Message edited by: Kay Tracid ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: simple jndi question