This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes NoIntailContextException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "NoIntailContextException" Watch "NoIntailContextException" New topic
Author

NoIntailContextException

Ajoy Sharma
Greenhorn

Joined: Feb 24, 2004
Posts: 18
Hi,
Iam using J2ee 1.4 server for EJB . Iam facing problem with client of when i run the client.
It giving the following error.
Exception isjavax.naming.NoIntailContextException:Need to specify class name in environment or Sysyetm property
my client code::
import javax.ejb.*;
import java.awt.*;
import java.awt.event.*;
import javax.rmi.*;
import java.rmi.*;
import javax.swing.event.*;
import javax.swing.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;

public class Client
{
public static void main(String[] args)
{
try
{
InitialContext context = new InitialContext();

Object obj = context.lookup("ServerObject"); //Server ejb-name
System.out.println(" Working here anand" );

ServerHome serverhome = (ServerHome)
PortableRemoteObject.narrow(obj , ServerHome.class);
Server server = serverhome.create();
String Message = JOptionPane.showInputDialog("Enter Your Message");
JOptionPane.showMessageDialog(null , server.performAction(Message) );

}
catch(Exception e)
{
JOptionPane.showMessageDialog(null ,"Exception is"+e);
}
}
}
any body can help me
Anand
Ade Barkah
Ranch Hand

Joined: Mar 17, 2004
Posts: 65
Since this client will run on its own JVM -- outside of the server's environment -- you'll need to configure how the client should contact the server by specifying the server's "initial context factory" and "provider url" during InitialContext's construction.
The exact configuration values varies between servers. For JBoss, it would look something like:

Instead of hardcoding the env entries in code, one would usually specify them in a properties file or from the command line.
HTH,
-Ade Barkah


-Ade<br /><a href="http://www.barkah.org" target="_blank" rel="nofollow">www.barkah.org</a>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: NoIntailContextException
 
Similar Threads
Sybase JNDI lookup woes
EJB Compilation
error: java.lang.ClassCastException
NoInitialContext Exception
error while running session bean