Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem invoking an EJB method from a JAVA client

Rohan Chaudhari
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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()
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");

catch(Exception e)

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 javax.rmi.CORBA.Util.mapSystemException(
at headfirst._Advice_Stub.getAdvice(Unknown Source)
at headfirst.AdviceClient.go(
at headfirst.AdviceClient.main(
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(
at java.lang.Class.newInstance0(
at java.lang.Class.newInstance(
at org.omg.CORBA.portable.ObjectImpl._invoke(
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