Forums Register Login

problem in EJB client.

+Pie Number of slices to send: Send
hi,
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

Would you turn that thing down? I'm controlling a mind here! Look ... look at the tiny ad ...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 799 times.
Similar Threads
very strange error
headfirst code not working
Problem while running a client
Getting a SocketOrChannelConnectionImpl in Weblogic
problem in running client code
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 22:35:09.