Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JNDI problem

 
Ingoba Ningthoujam
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Tomcat with Weblogic.I deploy web module in Tomcat5.0 and EJB module in Weblogic 8.1.When i call the lookup to JNDI EXCEPTION CLASSCASTEXCEPTION for the Home interface.I compile Web module using JDK1.5 and EJB using JDK1.4.1. Pliz help me.
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check if you are using the correct lookup string.
ClassCastException means that jndi is finding an object, but that it's type is not what you expect.
However, the info you provide is not sufficient to analyze further.

Regards, Jan
 
Ingoba Ningthoujam
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Well please tell me how to put the STUB of the EJB HomeInterace in web application which is running in Tomcat.whether I have to put it as JAR file or as JAVA file. My present directory structure is

EJB in WEBLOGIC
com.ingo.ejb
UserHome.class
UserRemote.class
UserBean.class
META-INF
ejb-jar.xml
weblogic-ejb-jar.xml
manifest

In Tomcat
webapp/web
src
com.ingo.struts.bd
UserDelegate.java
UserHome.java
UserRemote.java
com.ingo.struts.action
UserAction.java
class
com.ingo.struts.bd
UserDelegate.class
UserHome.class
UserRemote.class

My JNDI name is userHomeJNDI.

My lookup statement in UserDelegate.java is :
Properties p=new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL,"t3://localhost:7001");
Context ctx=new InitialContext(p);
UserHome uh=(UserHome)ctx.lookup("userHomeJNDI");

which is giving ClassCastException.Please help me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic