aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Runtime error with AviceBean from HFE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Runtime error with AviceBean from HFE" Watch "Runtime error with AviceBean from HFE" New topic
Author

Runtime error with AviceBean from HFE

Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442
When I run client program I am getting the following error
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Porta
bleRemoteObject.java:293)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
at AdviceClient.go(AdviceClient.java:18)
at AdviceClient.main(AdviceClient.java:10)
I have included AdviceAppClient.jar in classpath so I am running AdviceClient program using following command line
java AdviceClient
What might me the problem?
Thanks
Veena


SCJP1.4
"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
*Winston Churchill
Sudhir V
Ranch Hand

Joined: Dec 25, 2002
Posts: 143
Please redeploy the bean. It seems there's a naming conflict. See the link below
http://www.coderanch.com/forums/
Attach your AdviceClient code with the post.


Sudhir V<br />(SCJP 1.2, SCWCD, OCA, SCBCD)
Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442
Thanks.Here is my AdviceClient code

Mistake I did was I named AdviceBean as Adviser ,was calling Advisor in client programme.So I undeployed Bean,gave JNDI name as Advisor and run client code again.But I keep getting this exception.
Thanks again
Veena
Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442
Can somebody tell me if they have faced same problem?I undeployed and redeployed again.But still not working.
Thanks
Veena
manishguptaonweb Gupta
Greenhorn

Joined: Feb 08, 2004
Posts: 4
Got the same error, not debugged yet, hope to find the clue about it in chapter 3(Client view).
Sudhir V
Ranch Hand

Joined: Dec 25, 2002
Posts: 143
See its pretty obvious that the error is in this line
AdviceHome home=(AdviceHome)PortableRemoteObject.narrow(o,AdviceHome.class)
The cast operation ((AdviceHome)) is throwing error means that something which is beng returned from PortableRemoteObject.narrow(o,AdviceHome.class)
is not castable.
So the error narrows down to "PortableRemoteObject.narrow(o,AdviceHome.class)"
the container is able to recognize the PortableRemoteObject function but probably its not narrowing it down to an object which is castable. Most likely the error is with AdviceHome.class or the container is not able to find this class. Please make sure that classpath for the jar file is set right. Instead of setting the classpath permanently specify the path at runtime using java -cp.
Please check your other classpaths using this link
http://www.oreilly.com/catalog/hfjejb/errata/hfjejb.help
and compile using "javac -cp" and run using "java -cp"
Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442
I tried to print the object "o" which is result of narrowing.
System.out.println("lookup object: "+ o) gives
lookup object: com.sun.corba.ee.internal.iiop.CDRInputStream_1_0$1:IOR:00000000000002a524d493a6865616466697273742e416476696365486f6d653a303030303030303030303003030303000000000000001000000000000015c000102
It has long binar digits at the end which I have truncated
Thanks
Veena
[ February 08, 2004: Message edited by: Veena Point ]
Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442
Originally posted by Sudhir Vallam:
likely the error is with AdviceHome.class or the container is not able to find this class. Please make sure that classpath for the jar file is set right. Instead of setting the classpath permanently specify the path at runtime using java -cp.

Classpath for jar jar file is set right.I checked it.When I run using
java -cp {$CLASSPATH}:AdviceAppClient.jar AdviceClient command I get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: ex
Everything is fine.But still not working.
Veena
manishguptaonweb Gupta
Greenhorn

Joined: Feb 08, 2004
Posts: 4
I am getting an error in the last line of the code for the client(System.out.println(advisor.getAdvice()) . Any clues, it is giving the error( headfirst._Advice_Stub.getAdvice(Unknown Source)).
The whole stack trace is below.
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(Util.java:65)
at headfirst._Advice_Stub.getAdvice(Unknown Source)
at AdviceClient.go(AdviceClient.java:22)
at AdviceClient.main(AdviceClient.java:9)
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(NativeConstruct
orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
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(ObjectImpl.java:457)
at headfirst._Advice_Stub.getAdvice(Unknown Source)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Runtime error with AviceBean from HFE