• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in creating a HOME-Object  RSS feed

 
Hoyin Chan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a simple EJB-application. I have deployed the EJB component successfully using J2EE RI. It seems that the lookup of the Home Object is successful. However, when I created a EJB-Object from the Home-object, it generates an exception.
Part of the client code:
try {
System.out.println("1");
Context ic = new InitialContext();
System.out.println("2");
Object o = ic.lookup("Advisor");
System.out.println("3");
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o, AdviceHome.class);
System.out.println("4");
if(home==null)
System.out.println("Home is null");
else {
System.out.println("Home is not null");
Advice advisor = home.create();
System.out.println("5");
System.out.println(advisor.getAdvice());
System.out.println("6");
}
} catch(Exception e) {
e.printStackTrace();
}
The result:
1
2
3
4
Home is not null
java.rmi.AccessException: CORBA NO_PERMISSION 0 No; nested exception is:
org.omg.CORBA.NO_PERMISSION: vmcid: 0x0 minor code: 0 completed: No
at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.mapSystemException(ShutdownUtilDelegate.java:87)
at javax.rmi.CORBA.Util.mapSystemException(Unknown Source)
at headfirst._AdviceHome_Stub.create(Unknown Source)
at AdviceClient.go(AdviceClient.java:30)
at AdviceClient.main(AdviceClient.java:11)
Caused by: org.omg.CORBA.NO_PERMISSION: 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 Source)
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.getSystemException(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(GenericPOAClientSC.java:136)
at org.omg.CORBA.portable.ObjectImpl._invoke(Unknown Source)
... 3 more
Do anyone know what problem with my code. I follow the instruction in the book.
[ March 30, 2004: Message edited by: Hoyin Chan ]
 
Hoyin Chan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I solved the problem finally. Thanks to the author Kathy of "Head First EJB".
For someone having the same problem, try this out:
When you deploy using J2EE RI Deploytool, you need to change the setting first.
Go to the Security Tab under your Bean application.
Then click on the button "Deployment Settings"
Then click the radio button "Support Client Choice".
Then deploy it again.
It works.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!