import-bot (20212) [Avatar] Offline
#1
[Originally posted by lmolter]

I tried the JNDI examples from the book to look up the home interface of an
entity bean I wrote. The lookup always fails, even though my code is exactly
like the book's (with changes to the package and bean names). However, if I
use SessionManager to do the lookup, it works fine. JNDI is much simpler to
code, but I don't know enough about this service to know why it fails.

Part of the error message claims that the 'delagator is not set'.

I'll post more details if needed.

Larry
import-bot (20212) [Avatar] Offline
#2
Re: JNDI lookup fails
[Originally posted by mbarlotta]

Try posting some code

Mike
import-bot (20212) [Avatar] Offline
#3
Re: JNDI lookup fails
[Originally posted by lmolter]

> Try posting some code
>
> Mike

Sorry. I thought perhaps there was something amiss with the examples. Anyway,
here's the code. It throws a NamingException on lookup().

----
java.util.Properties props = new java.util.Properties();
props.put (javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"com.sybase.ejb.InitialContextFactory");

props.put(javax.naming.Context.PROVIDER_URL, "iiop://localhost:9000");

try {
jndi_cxt = new javax.naming.InitialContext(props);
}
catch (javax.naming.NamingException ne) {
System.out.println("Naming Exception from InitialContext():" +
ne.getExplanation());
System.out.println("Naming Exception from InitialContext():" +
ne.toString(true));
}

try {
// cabinHome is declared elsewhere as
// com.titan.cabin.CabinHome
cabinHome = (com.titan.cabin.CabinHome)jndi_cxt.lookup("Cabin");
}
catch (javax.naming.NamingException ne) {
System.out.println("Naming Exception from InitialContext():" +
ne.getExplanation());
System.out.println("Naming Exception from InitialContext():" +
ne.toString(true));
System.exit(1);
}

-----------------
As you can see, it's right from the book (page2 108, 109). The only real
difference is my bean's name. if I use the code from page 110 instead
(SessionManager), it works fine.

Larry
import-bot (20212) [Avatar] Offline
#4
Re: JNDI lookup fails
[Originally posted by lmolter]

Mike, here's the console output from the code fragment I posted earlier:

Naming Exception from InitialContext():null
Naming Exception from InitialContext():[Root exception is
org.omg.CORBA.BAD_OPERATION: The delegate has not been set! minor code: 0
completed: No]javax.naming.NamingException


Larry