J
jrefactors
I am new to EJB. I am using WSAD v5.12 to develop EJB project. The
following HelloWorld example is from Mastering EJB book by Ed Ramon.
I got the following run time errors. Please advise. thanks!!
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file: java.naming.factory.initial
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:292)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at HelloEJBClient.main(HelloEJBClient.java:32)
Exception in thread "main"
=========================================================
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Properties;
public class HelloClient
{
public static void main(String[] args) throws Exception
{
Properties props = System.getProperties();
Context ctx = new InitialContext(props);
Object obj = ctx.lookup("HelloHome");
HelloHome home =
(HelloHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloHome.class);
Hello hello = home.create();
System.out.println(hello.hello());
hello.remove();
}
}
following HelloWorld example is from Mastering EJB book by Ed Ramon.
I got the following run time errors. Please advise. thanks!!
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file: java.naming.factory.initial
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:292)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at HelloEJBClient.main(HelloEJBClient.java:32)
Exception in thread "main"
=========================================================
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Properties;
public class HelloClient
{
public static void main(String[] args) throws Exception
{
Properties props = System.getProperties();
Context ctx = new InitialContext(props);
Object obj = ctx.lookup("HelloHome");
HelloHome home =
(HelloHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloHome.class);
Hello hello = home.create();
System.out.println(hello.hello());
hello.remove();
}
}