• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to access EJB from Client App

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Desai.
I got it right. Thanx for ur help.
 
reply
    Bookmark Topic Watch Topic
  • New Topic