wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes HeadFirst: AdviceBean ...interesting problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "HeadFirst: AdviceBean ...interesting problem" Watch "HeadFirst: AdviceBean ...interesting problem" New topic
Author

HeadFirst: AdviceBean ...interesting problem

Vivek Viswanathan
Ranch Hand

Joined: Mar 03, 2001
Posts: 350
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


Vivek Viswanathan SCJP 1.2, SCJP 1.6,SCJD,SCEA,SCWCD,IBM-484,IBM-486,IBM-141,Ms.NET C# 70-316,SCMAD, LPIC-I
vinod bellary
Greenhorn

Joined: Jun 06, 2002
Posts: 1
Vivek,
I too got the same problem and it worked when I changed the method name to something else.
This issue is also discussed somewhere in this forum.


Thanks<br />Vinod Bellary
Vivek Viswanathan
Ranch Hand

Joined: Mar 03, 2001
Posts: 350
Hi
Could you please give me the URL for that discussion ...
Got it
http://www.coderanch.com/t/158262/java-EJB-SCBCD/certification/CORBA-bad-operation-error-RI

v
[ January 20, 2004: Message edited by: Vivek Viswanathan ]
David Harrigan
Ranch Hand

Joined: Sep 16, 2003
Posts: 43
Hi,
There's a succient answer to be found here:-
http://www.oreilly.com/catalog/hfjejb/errata/hfjejb.confirmed
-=david=-
Vivek Viswanathan
Ranch Hand

Joined: Mar 03, 2001
Posts: 350
Cheers
I just realized something,
In my solution I replaced getAdvice() with sayAdvice() and it worked with out a problem.
How is this solution working since my business method still has the word Advice in it which matches the Interface name
Any Ideas ?
Vivek
 
GeeCON Prague 2014
 
subject: HeadFirst: AdviceBean ...interesting problem