*
The moose likes Tomcat and the fly likes JNDI problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "JNDI problem" Watch "JNDI problem" New topic
Author

JNDI problem

Ingoba Ningthoujam
Ranch Hand

Joined: Dec 04, 2006
Posts: 90
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

Joined: Dec 20, 2006
Posts: 2497
    
    8

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


OCUP UML fundamental and ITIL foundation
youtube channel
Ingoba Ningthoujam
Ranch Hand

Joined: Dec 04, 2006
Posts: 90
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI problem