This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Problem invoking an EJB method from a JAVA client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Problem invoking an EJB method from a JAVA client" Watch "Problem invoking an EJB method from a JAVA client" New topic
Author

Problem invoking an EJB method from a JAVA client

Rohan Chaudhari
Greenhorn

Joined: Mar 18, 2006
Posts: 10
Hi,

I have written and deployed a EJB object on an J2EE server. I am invoking it from a JAVA client. Below is the source code for the java client:

package headfirst;

import javax.naming.*;
import java.rmi.*;
import javax.rmi.*;
import headfirst.*;
import javax.ejb.*;

public class AdviceClient
{

public void go()
{
try
{
Context ic = new InitialContext();

if(ic != null)
System.out.println("Got the Context");
Object o = ic.lookup("Advisor");

if(o != null)
System.out.println("Got the Lookup Object");


AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o,AdviceHome.class);

if(home != null)
System.out.println("Got the ADviceHome");

Advice advisor = home.create();

if(advisor != null)
System.out.println("Got the Advisor");

System.out.println(advisor.getAdvice());
}
catch(Exception e)
{
e.printStackTrace();
}
}

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

I have compiled this code using the client jar created by J2EE deploy tool. By while running the code, I got the following exception:

C:\Rohan\JavaProject\EJB\Advice>java headfirst.AdviceClient
Got the Context
Got the Lookup Object
Got the ADviceHome
Got the Advisor
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.mapSystemExceptio
at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)
at headfirst._Advice_Stub.getAdvice(Unknown Source)
at headfirst.AdviceClient.go(AdviceClient.java:36)
at headfirst.AdviceClient.main(AdviceClient.java:46)
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(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:296)
at java.lang.Class.newInstance(Class.java:249)
at com.sun.corba.ee.internal.iiop.messages.ReplyMessage_1_2.getSystemExc
at com.sun.corba.ee.internal.iiop.ClientResponseImpl.getSystemException(
at com.sun.corba.ee.internal.POA.GenericPOAClientSC.invoke(GenericPOACli
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
at headfirst._Advice_Stub.getAdvice(Unknown Source)
... 2 more


Can anybody help me understand why this is happening?
 
Consider Paul's rocket mass heater.
 
subject: Problem invoking an EJB method from a JAVA client
 
Similar Threads
Head First EJB: 1st tut error
Advisor error
AdviceGuy Exception
Problem to run the Cilent about HFEJB chapter1
HF EJB. AdviceBean example. BAD_OPERATION exception