Hi, The Elephant walker.
Sure the error says domain was null, but the situation is that the
servlet is just an another stand-alone program (not part of deployed Hello
Session Bean) residing in
D:\Oracle\iSuites\j2ee\home\default-web-app\WEB-INF\classes\trg\HelloServlet
directory and from there I'm trying to access Hello Session Bean which is
deployed on the Orion. Both client and server are on the same machine as
I'm testing this saught of workability. So I guess domain name won't be
needed and if yes could you elaborate on domain name you are talking about
Regards
Prashant
-----Original Message-----
From: The elephantwalker [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 11, 2001 4:28 PM
To: Orion-Interest
Subject: RE: Calling EJB From a Servlet..
First, if the servlet and ejb are in the same application, you don't need to
use properties to initialize your context....but if you did, it looks like
you left off the domain in the properties.
Regards,
the elephantwalker
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Prashant
Gaikwad
Sent: Tuesday, September 11, 2001 3:27 AM
To: Orion-Interest
Subject: Calling EJB From a Servlet..
HI Friends,
I'm having a serious problem in my code and am unable to
understand. I've deployed a simple Hello bean on the orion container and
want to access it from a servlet. I have the servlet in
D:\Oracle\iSuites\j2ee\home\default-web-app\WEB-INF\classes\trg\HelloServlet
. Following is the code in servlet
try {
trace("In Try");
Hashtable h = new Hashtable();
h.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.
RMIInitialContextFactory");
h.put(javax.naming.Context.SECURITY_PRINCIPAL,
"ejb");
h.put(javax.naming.Context.SECURITY_CREDENTIALS,
"ejbadmin");
h.put(javax.naming.Context.PROVIDER_URL,"ormi://localhost/Hello");
trace("Before Init Contect ");
Context context = new InitialContext (h);
trace("after Initial context");
Object boundObject =
context.lookup("java:comp/env/ejb/HelloHome");
trace("At Trap");
helloHome = (HelloHome)
javax.rmi.PortableRemoteObject.narrow(boundObject,HelloHome.class);
}
catch (Throwable exception) {
exception.printStackTrace();
//System.out.println("Look up exception :" +
exception.toString());
//throw new ServletException(
// "Unable to get home interface: " + exception.toString());
}
When I run servlet from browser I get an exception when the Context is
getting crerated as folloew
D:\Oracle\iSuites\j2ee\home>java -jar orion.jar
Oracle9iAS (1.0.2.2) Containers for J2EE initialized
ConstructorBefore TryIn TryBefore Init Contect
java.lang.NullPointerException: d
omain was null
at com.evermind.server.rmi.RMIServer.addNode(RMIServer.java:428)
at
com.evermind.server.rmi.RMIServer.getConnection(RMIServer.java:497)
at
com.evermind.server.rmi.RMIInitialContextFactory.getInitialContext(RM
IInitialContextFactory.java:150)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at trg.HelloServlet.init(HelloServlet.java:49)
at
com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.
java:1580)
at
com.evermind.server.http.HttpApplication.findServlet(HttpApplication.
java:3722)
at
com.evermind.server.http.HttpApplication.getRequestDispatcher(HttpApp
lication.java:1995)
at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpReques
tHandler.java:444)
at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
va:189)
at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
In _hello
Please let me know where I'm going wrong.
Thanks in advance
Prashant