File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Head First EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Head First EJB" Watch "Head First EJB" New topic

Head First EJB

Oscar Diaz

Joined: Apr 16, 2004
Posts: 3
I've been learning EJB with this book on EJB. I was able to create and deploy the Advisor bean using deploytool with 'Advisor' as JNDI Name (without the quotes). When I run the AdviceClient to invoke getAdvice() on the bean, I got
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(
40)at javax.naming.InitialContext.getDefaultInitCtx(
)at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
a:280)at javax.naming.InitialContext.lookup(
at AdviceClient.go( at AdviceClient.main(
My J2EE 1.3 RI Server on Windows XP is running smoothly with this final message on the console
Loading jar:/C:/j2sdkee1.3.1/repository/master/applications/AdviceApp10828111758
J2EE server startup complete.

The command that caused the error was -
java -cp AdviceAppClient.jar;c:\j2sdkee1.3.1\bin\j2ee.jar;d:\projects\java\advice AdviceClient
Any suggestions will be much appreciated.

Shih-Chia Cheng

Joined: Apr 08, 2004
Posts: 2
I use this book to learn EJB too;
And I also encountered some problems with this example program, but the exception message was different, they were generated after calling getAdvice() method with the remote object, as follows:

java.rmi.RemoteException: CORBA BAD_OPERATION 0 No; nested exception is:
org.omg.CORBA.BAD_OPERATION: vmcid: 0x0 minor code: 0 completed: No
at javax.rmi.CORBA.Util.mapSystemException(
at headfirst._Advice_Stub.getAdvice(Unknown Source)
at AdviceClient.go(
at AdviceClient.main(
Caused by: org.omg.CORBA.BAD_OPERATION: vmcid: 0x0 minor code: 0 completed:
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
at java.lang.reflect.Constructor.newInstance(
at java.lang.Class.newInstance0(
at java.lang.Class.newInstance(
at org.omg.CORBA.portable.ObjectImpl._invoke(
at headfirst._Advice_Stub.getAdvice(Unknown Source)
... 2 more
I really don't know why I got this kind of weird and mystic exception.
Can somebody help? Thanks!
Jeff Pavlocak

Joined: Apr 26, 2004
Posts: 16
Check out the EJB Certification (SCBCD) forum, "error in compilation" post updated April 26th 2004.
I believe the link below will take you there, but if not use the above. The answer is in there.
Hope this helps.
Johannes de Jong

Joined: Jan 27, 2001
Posts: 5089
Also have a look here Head First EJB: 1st tut error
Good luck.
I agree. Here's the link:
subject: Head First EJB