Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

problem in EJB client.

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
rubbery bacon. rubbery tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic