This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error While running AdviceBean from HFEJB

 
Micheal Jacob
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,

When i try running AdviceBean from HFEJB,
i get the following error. (I have j2ee.jar, in classpath)

java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:291)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:132)
at AdviceClient.go(AdviceClient.java:24)
at AdviceClient.main(AdviceClient.java:14)


Any clue, pls ?

Thanks in advance.

Micheal.
 
Micheal Jacob
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,

I use JDK 1.3.1_07 & J2SDKEE 1.3.1
I dont see anybody facing this problem with PortableRemoteObject.narrow(). (i tried searching here..but could not find any thread)

Micheal
 
vikas prasad
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Micheal,
It is because you have not set your environment variable properly.
If you set your environment variable as i say. i am sure your program will run.

CLASSPATH C:\j2sdkee1.3.1\lib\j2ee.jar;D:\Certification\projects\advice

D:\Certification\projects\advice This is the folder where you will have your AdviceAppClient.jar file. see do not put the jar file name ok just the path to the directory. ok

J2EE_HOME C:\j2sdkee1.3.1

JAVA_HOME C:\jdk1.3.1_16

PATH C:\j2sdkee1.3.1\bin;C:\jdk1.3.1_16\bin;

ok now compile
javac -classpath %CLASSPATH%; AdviceAppClient.jar AdviceClient.java

and run the program
java -cp %CLASSPATH%; AdviceAppClient.jar AdviceClient

bingo....
it will run.
cheers

vikas prasad
SCJP 1.4 SCWCD 1.4 SCBCD 1.3
 
Micheal Jacob
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vikas,

Thanks, it solved the problem. But i am confused.

BTW, why we have to add "D:\Certification\projects\advice" into classpath without the jar file name ?

Does this make any difference ?

Appreciate your help.

Micheal.
 
vikas prasad
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you dont have to add it but remember when you compile and run the program you have to give the full classpath so that it can find the class files. if you set it as enviroment variable you dont have to give the whole path.
cheers
vikas prasad
SCJP 1.4 SCWCD 1.4 SCBCD1.3
 
MI Mohammed
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Micheal,
Sorry if this is comming late. From your exception message
You were almost there, the cast exception means the remote stub
wasn't cast to the client stub, so just simple add the generated
client.jar to your classpath. You should be ok.

Hope it's help.
Thanks and have a nice Java session.

SCJA SCJP SCWCD SCBCD Pro....

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic