This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoIntailContextException

 
Ajoy Sharma
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic