• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

headfirst code not working

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I am using windows XP pro operating system.
I am using a first ejb example in HeadFirst example The advice bean one
but i have changed the name to HelloBean . 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
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This is a know problem and has been asked before on this forum. Explanation and solution are at the following http://www.wickedlysmart.com/HeadFirst/HeadFirstEJB/HeadFirstEJBNotes.html
 
I want my playground back. Here, I'll give you this tiny ad for it:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic