aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Problem to run the Cilent about HFEJB chapter1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Problem to run the Cilent about HFEJB chapter1" Watch "Problem to run the Cilent about HFEJB chapter1" New topic
Author

Problem to run the Cilent about HFEJB chapter1

woo hwang
Greenhorn

Joined: Dec 13, 2006
Posts: 23
Hi. guys.
I have a problem to run client. There were not any problem up to compile client.
After i run the client.... i got message below.
--------------------------------------------------------------------------
C:\SCBCD_PRAC\projects\advice>java -cp %J2EE_JARS%;AdviceAppClient.jar; AdviceClient
ic
look up the Advisor
cast
create
getAdvice
ERROR
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.go(AdviceClient.java:25)
at AdviceClient.main(AdviceClient.java:10)
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)
... 2 more
--------------------------------------------------------------------
import javax.naming.*;
import java.rmi.*;
import javax.rmi.*;
import headfirst.*;
import javax.ejb.*;

public class AdviceClient {

public static void main(String[] arg) {
new AdviceClient().go();
}

public void go(){

try{
System.out.println("ic");
Context ic = new InitialContext();

System.out.println("look up the Advisor");
Object o = ic.lookup("Advisor");

System.out.println("cast");
AdviceHome home = (AdviceHome)PortableRemoteObject.narrow(o, AdviceHome.class);

System.out.println("create");
Advice advisor = home.create();

System.out.println("getAdvice");
System.out.println( advisor.getAdvice() );

}catch(Exception ex){
System.out.println("ERROR");
ex.printStackTrace();
}
}

}
---------------------------------------------------------------------------
i need a help.....
Mansur Khan
Ranch Hand

Joined: Mar 27, 2007
Posts: 50
Change the name of the method getAdvice() to get<Whatever-Except-Remote-Component-Interface-Name>

For example change getAdive() to getMessage() or getFreeAdvice() etc.

This is a bug in Sun RI. Don't forget to recompile, repackage, redeploy and re-run the client.


SCDJWS, SCBCD, SCJP
woo hwang
Greenhorn

Joined: Dec 13, 2006
Posts: 23
Thanks...
It works now. However, what kind of thing should i care of?
the name of method was wrong?
Mansur Khan
Ranch Hand

Joined: Mar 27, 2007
Posts: 50
FYI
-------------
HELPFUL NOTE FROM AUTHORS:

Hello!

We have discovered something that -- while not being an errata -- is a bug in the J2EE software that is showing up in our main opening tutorial exercise.

Here it is... for the chapter 1 Advice Guy application (not tied to a specific page)

If you receive a CORBA.BAD_OPERATION error when you run the client, you may be experiencing
a bug that exists in some versions of the J2EE Reference Implementation.

The R.I. bug is:

* You can't have a method name that has the same characters as the interface name. Remember, this is a bug in the RI, and NOT a rule from the EJB spec.

* In the Advice application, the interface currently looks like this:

public interface Advice extends EJBObject {
public String getAdvice() throws RemoteException;
}

The problem is that getAdvice() contains the characters "Advice" that match the interface name, and this *can* in some systems, cause the bug. We can't specify exactly which combination of versions and OS produces the problem, except to say that the Linux distribution of J2EE
1.3.1 on Max OSX 10.2 and 10.3 does not have a problem.

The FIX is:

1) Change the business method name to something else in the interface:

public interface Advice extends EJBObject {
public String getTheMessage() throws RemoteException;
}

2) Change the business method implementation in the bean class to match.

3) Change the client code that calls the method, to reflect the new method name.

4) Undeploy the current version and cleanup the server using;

* run "cleanup" (without the quotes) at the command-line (this will undeploy your application and
take the server back to the state it was in when installed.)

* Delete your existing .ear file (and any .temp files, if you see them in your projects or Advice directory)

5) Restart the server and restart deploytool

6) Recreate the application and the bean (using New --> Enterprise bean) and start over.

7) Be sure to wear your 'lucky t-shirt' while doing this. The R.I has been known to respond to some forms
of superstition. Or maybe it's just an urban legend...

8) Run the client again and voila! Success! Finally!

--------------------------------------------------------
 
jQuery in Action, 2nd edition
 
subject: Problem to run the Cilent about HFEJB chapter1