Forums Register Login

HF-EJB - initial context in chapter 1

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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,
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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).
+Pie Number of slices to send: Send
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,
Hot dog! An advertiser loves us THIS much:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1122 times.
Similar Threads
JUnit with apache's cactus
Why ejbPassivate and ejbRemove are not called by weblogic container?
About accessing EJB
Advice Client problem
any hints for this SCEAJ question?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:01:09.