| Author |
HF-EJB - initial context in chapter 1
|
Bear Giles
Greenhorn
Joined: Mar 16, 2006
Posts: 25
|
|
Hi, I'm going through the "hello world" -- I mean "advisor" -- program in chapter one to verify I have the complete toolset. Everything is cool until I try to run the client. I get a javax.naming.NoInitialContextException. I expected this since it's being run directly and I didn't see anything setting up the JNDI environment. Did I miss something, or is it an oversight in the book. I'm used to setting up the JNDI information in a web container, but this is the first time I've had to set up an EJB container.
|
SCJP 5 & 1.4, SCWCD 1.4, SCBCD 1.3; Security+
|
 |
Balaji Anand
Ranch Hand
Joined: Nov 03, 2004
Posts: 146
|
|
this is how changed it when i faced problem Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory"); p.put(Context.PROVIDER_URL, "iiop://localhost:3700"); Context ic = new InitialContext(p); Please update if it helps.
|
 |
Bear Giles
Greenhorn
Joined: Mar 16, 2006
Posts: 25
|
|
Thanks. I needed port 1050 instead of port 3700 -- you would expect those properties to be easily found in documentation! I get a "no connection" message on port 3700. I can now get past the lookup and 'narrow'. But when I try to call home.create() I get "java.rmi.AccessException: CORBA NO_PERMISSION 0 No" and "vmcid: 0x0 minor code: 0 completed: no" messages. It also happens when I try running the app as root.
|
 |
SL Narasimhan
Greenhorn
Joined: Jul 19, 2005
Posts: 22
|
|
Use the code given in HeadFirst but have asppserv-rt.jar in ur classpath. That's all. It works fine. Reason is SerialInitialContext Factory is located in appserv-rt.jar. Cheers,
|
SCJP 1.4<br />SCWCD 1.4<br />SCBCD 1.3<br />IBM Certified Solution Developer - WebSphere Portal 6<br />IBM WebSphere Portal 6 Deployment and Administration
|
 |
Bear Giles
Greenhorn
Joined: Mar 16, 2006
Posts: 25
|
|
|
I couldn't find that system (or something with a similar name) anywhere on my system. Ditto any 1.3 jar file containing that classname.
|
 |
Bear Giles
Greenhorn
Joined: Mar 16, 2006
Posts: 25
|
|
I spoke too quickly -- I hadn't found it when I looked under /, but it was in the 1.4 appserver library. Unfortunately I still get the NO_PERMISSION error with both InitialContext() and InitialContext(p).
|
 |
SL Narasimhan
Greenhorn
Joined: Jul 19, 2005
Posts: 22
|
|
Hi There, Well I didn't tell u that I ran my code in 1.4. All you need to do is compile the code as it is and execute the following comand java -cp .;<SUN_HOME>/AppServer/lib/appserv-rt.jar AdviceHome where <SUN_HOME> refers to your installation directory. Then the code works fine. If you find any issues just paste the logs. Cheers,
|
 |
 |
|
|
subject: HF-EJB - initial context in chapter 1
|
|
|