• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Unable to access EJB from Client App

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have successfully deployed the EJB under /myserver/ directory, but when I try to run the client program the following error is reported :
javax.Naming.NoIniitialContextException : Need to specify class name in one or system property or as an applet parameter or in application resource
My client program is given below
import java.util.Properties;
import trial.*;
import javax.naming.*;
import java.rmi.*;
public class Client
{
public static void main(String s[])
{
try
{
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.InitialContextFactory");
p.put(Context.PROVIDER_URL, "t3://localhost:7001";);
p.put(Context.SECURITY_PRINCIPAL,"");
p.put(Context.SECURITY_CREDENTIALS,"");
InitialContext ic = new InitialContext(p);
HelloHome home = (HelloHome)ic.lookup("trial.HelloHome");
Hello hel = home.create();
System.out.println("Msg from server...:" + hel.sayHello("Apt"));
hel.remove();
}catch(Exception e){e.printStackTrace();}
}
}
Please help me out in solving the problem
Thanx in Advance
Roshini
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roshini,
You have to first run setenv.cmd in your client window. You can find setenv.cmd in the WEBLOGIC_HOME directory. But doing this you will get the Weblogic classes in the CLASSPATH. Now run the client and it will not complain.
Hope this helps.
Regards,
Prasad
 
Roshini Sridharan
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Desai.
I got it right. Thanx for ur help.
 
expectation is the root of all heartache - shakespeare. tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic