Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in JNDI lookup (from Tomcat to Sun ONE Studio)

 
Y�ako M.
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I'm trying to lookup a EJB from a web module. There's no problem when I use 'Sun ONE Application server' as both ejb and web container. Now, I want to use Tomcat as web container. The code for the lookup looks like this:
java.util.Properties env = new java.util.Properties();
env.setProperty("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");
env.setProperty("java.naming.provider.url", "iiop://localhost:3700");
InitialContext ctx = new InitialContext(env);
beanHome = ctx.lookup("ejb/TestEJB");

In the first case (only 'Sun ONE App. server) the call to ctx.lookup() returns a reference to the bean's home interface, but the same call from Tomcat returns a CORBA class (com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1).
Can someone help me?
Thanks in advance.
 
Balaji Thirnrayan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you solve this problem, If yes please let me know how you solved as I cannot get it working.
 
Mani Narayanan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying changing the initial context factory class, the context factory which you have provided may work with Sun ONE App server.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic