File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

HeadFirst: AdviceBean ...interesting problem

Vivek Viswanathan
Ranch Hand

Joined: Mar 03, 2001
Posts: 350
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 javax.rmi.CORBA.Util.mapSystemException(
at headfirst._Advice_Stub.getAdvice(Unknown Source)
at AdviceClient.main( 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(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
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)
... 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 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
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 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

Joined: Jun 06, 2002
Posts: 1
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
Could you please give me the URL for that discussion ...
Got it

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

Joined: Sep 16, 2003
Posts: 43
There's a succient answer to be found here:-
Vivek Viswanathan
Ranch Hand

Joined: Mar 03, 2001
Posts: 350
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 ?
I agree. Here's the link:
subject: HeadFirst: AdviceBean ...interesting problem
It's not a secret anymore!