It's not a secret anymore!
The moose likes EJB and other Java EE Technologies and the fly likes JNDI problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JNDI problem" Watch "JNDI problem" New topic

JNDI problem

Robert Bonslater

Joined: Jan 30, 2005
Posts: 28
When I try to bind name and entity using JNDI what does this mean:

log4j:WARN No appenders could be found for logger (org.jnp.interfaces.NamingCont
log4j:WARN Please initialize the log4j system properly.
javax.naming.CommunicationException: Receive timed out [Root exception is java.n
et.SocketTimeoutException: Receive timed out]

I added some String executions to find the problem and it is obviously at
ctx.bind(name, entity);
Here is a piece if my code:

try {
// For clarity, command-line args in local vars
String name = args[0];
Integer entity = Integer.valueOf(args[1]);
// Access the initial context.
Context ctx = new InitialContext();
// Bind name to entity in the Context.
ctx.bind(name, entity);
// To test, retrieve the entity through the name
Integer retrieved = (Integer) ctx.lookup(name);
System.out.println("From lookup: " + retrieved);
catch(NamingException e) { System.err.println(e); }
catch(NumberFormatException e) { System.err.println(e); }
[ April 04, 2005: Message edited by: Robert Bonslater ]
Yuan Ye
Ranch Hand

Joined: Mar 05, 2003
Posts: 172
Is your AS started before the program, looks like sth wrong with the system environment.
Clemens Tolboom

Joined: Feb 15, 2005
Posts: 12
As far as i can see the log4j warning is about a misconfigured log4j.xml or file. Have you checked this file?

Anyway ... it's just a warning ... you app should still work.

log4j is 'just' a logging framework.
[ April 06, 2005: Message edited by: Clemens Tolboom ]
I agree. Here's the link:
subject: JNDI problem
It's not a secret anymore!