aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes JNDI lookup problem in advice client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "JNDI lookup problem in advice client" Watch "JNDI lookup problem in advice client" New topic
Author

JNDI lookup problem in advice client

Mukesh Parsana
Greenhorn

Joined: Apr 12, 2005
Posts: 2
I am preparaing for SCBCD exam. But because of the following problem, I am not able to move ahead on my preparation path. Please solve my problem as soon as possible. Thanks in advance.

I am using j2ee 1.3 RI. My advice client code is pasted below
-----------------------------------------------------------------
public class AdviceClient
{
public static void main(String args[])
{
new AdviceClient().go();
}

public void go()
{
try
{
Hashtable env=new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
env.put(Context.PROVIDER_URL, "localhost:1050");
Context ic=new InitialContext(env);
Object o=ic.lookup("Advisor");
AdviceHome home=(AdviceHome) PortableRemoteObject.narrow(o, AdviceHome.class);
Advice advisor=home.create();
System.out.println(advisor.getTheMessage());
}
catch(Exception e)
{
e.printStackTrace();
}
}
}


It is showing the following error.
-------------------------------------------------------------
D:\ejbprojects\advice>java -cp d:\ejbprojects\advice\AdviceAppClient.jar;d:\ejbp
rojects\advice AdviceClient
javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterp
rise.naming.SerialInitContextFactory. Root exception is java.lang.ClassNotFound
Exception: com.sun.enterprise.naming.SerialInitContextFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at AdviceClient.go(AdviceClient.java:23)
at AdviceClient.main(AdviceClient.java:13)


Mukesh Parsana,<br />Projet Engineer(Finance & security)<br />WIPRO Technologies, India<br />SCJP 1.4<br />SCWCD 1.4<br />SCBCD 1.3 (preparing)
Keerthi P
Ranch Hand

Joined: Aug 19, 2003
Posts: 203
Please do a search in this forum. There are tons of postings here on the same topic.


Cheers.<br />Keerthi<br />(SCJP, SCWCD, SCBCD)
Mukesh Parsana
Greenhorn

Joined: Apr 12, 2005
Posts: 2
Originally posted by Keerthi P:
Please do a search in this forum. There are tons of postings here on the same topic.


Thank you very much keerthi. Actually I was not able to run program using j2ee 1.3 RI. But on j2ee 1.4, it is running successfully.
Thank you very much for your help.
ShivShankar
Greenhorn

Joined: Mar 18, 2005
Posts: 12
Hi Mukesh,
Please try to put the %J2EE_HOME%\lib\j2ee.jar;%J2EE_HOME%\lib;.; in the classpath of your environment variables and execute.






FourSoft Ltd,
Hyderabad


Shivu<br />(SCJP1.4,SCBCD(In Progress..)<br />We are what we think.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI lookup problem in advice client