hi,
I am using windows XP pro operating system.
I am using a simple
ejb example . But it is not working but throwing an exception at the time of running client.
the files are
1) Hello.java
package examplesejb;
import javax.ejb.*;
import java.rmi.RemoteException ;
public interface Hello extends javax.ejb.EJBObject
{
public
String hello() throws java.rmi.RemoteException;
}
2)HelloBean.java
package examplesejb;
public class HelloBean implements javax.ejb.SessionBean
{
private javax.ejb.SessionContext ctx;
public void ejbCreate() {
System.out.println("Ejbcreate()");
}
public void ejbRemove() {
System.out.println("EjbRemoce()");
}
public void ejbActivate() {
System.out.println("EjbActivate()");
}
public void ejbPassivate() {
System.out.println("EjbPassivate()");
}
public void setSessionContext(javax.ejb.SessionContext ctx){
this.ctx = ctx;
}
public String hello(){
System.out.println("hello()");
return "Hello World";
}
}
3)HelloHome.java
package examplesejb;
public interface HelloHome extends javax.ejb.EJBHome
{
Hello create() throws java.rmi.RemoteException,javax.ejb.CreateException ;
}
4)HelloClient.java
import javax.naming.*;
import java.rmi.* ;
import examplesejb.*;
import javax.ejb.*;
public class HelloClient{
public static void main(String[] args) throws Exception
{
try{
Context ctx = new InitialContext();
Object obj = ctx.lookup("HelloAdv");
HelloHome home = (HelloHome) javax.rmi.PortableRemoteObject.narrow(obj,HelloHome.class);
Hello hello = home.create();
System.out.println("HERERER");
String s = hello.hello();
System.out.println("HERERER2222");
hello.remove();
}catch(Exception e)
{
e.printStackTrace();
}
}
}
the directory structure is projects\Hello\src\examplesejb
the above all files complied successfully, the Bean was deployed by using
deploytool also verified it with the verifiy tool.
But when i run the HelloClient i get the below error
C:\projects\Hello>
java -classpath %CLASSPATH%;HelloAppClient.jar HelloClient
HERERER
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
n(ShutdownUtilDelegate.java:137)
at javax.rmi.CORBA.Util.mapSystemException(Unknown Source)
at examplesejb._Hello_Stub.hello(Unknown Source)
at HelloClient.main(HelloClient.java:20)
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(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.corba.ee.internal.iiop.messages.ReplyMessage_1_2.getSystemExc
eption(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(GenericPOACli
entSC.java:132)
at org.omg.CORBA.portable.ObjectImpl._invoke(Unknown Source)
at examplesejb._Hello_Stub.hello(Unknown Source)
... 1 more
what could be wrong please help