Hi
I was working on Advice Bean from the Head First
EJB book, this is the
first Stateless Session Bean in the book from chapter 1(intro to EJB)
The bean defines an the following business method
public
String getAdvice()
I wrote the program exactly as specified in the book and I am also using
the correct version of J2EE RI and J2SDK as specified in the book.
The Bean was deployed sucessfully but on running the client I would get the
following exception
Exception in
thread "main" java.rmi.RemoteException: CORBA BAD_OPERATION 0 No; nested exception is:
org.omg.CORBA.BAD_OPERATION: vmcid: 0x0 minor code: 0 completed: No
at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.mapSystemException(ShutdownUtilDelegate.java:137)
at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)
at headfirst._Advice_Stub.getAdvice(Unknown Source)
at AdviceClient.main(AdviceClient.java:27) Caused by: org.omg.CORBA.BAD_OPERATION: vmcid: 0x0 minor code: 0 completed:No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at com.sun.corba.ee.internal.iiop.messages.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:93)
at com.sun.corba.ee.internal.iiop.ClientResponseImpl.getSystemException(ClientResponseImpl.java:108)
at com.sun.corba.ee.internal.POA.GenericPOAClientSC.invoke(GenericPOAClientSC.java:132)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
at headfirst._Advice_Stub.getAdvice(Unknown Source)
... 1 more
After racking my brains and trying out a hell lot of stuff I could not figure out the problem.
So I decided to write another bean (the famous hello world bean) and this bean had business method called
public String sayHello()
and this time I didnt get any exception at all....now this was really wired, so I compared the code and both were identical except that it had
a diffrent bean name and different business method.
After spending couple of hours checking the code again, I happend to look at security tab on the J2EE RI deployment tool for 'Advice Bean' and I
noticed
that the security tab contains the list of methods so that we can set the method permissions and in this list
the business method 'getAdvice' was next to the EJBObject method 'getHandle' etc......that is when it hit me that the problem could probally be
because of the
business method name starting with 'get', I changed the name of the business method to 'sayAdvice' and everything worked fine. I also could re- create
the problem by changing the business method of Hello World Bean to 'getHello' and I faced the same problem again.
Has this problem been stated in the book Errata ? If it has then you can ignore this post ?
Vivek