Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem invoking an EJB method from a JAVA client

 
Rohan Chaudhari
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic