Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFEJB- Page57 - AdviceClient

 
Vishnu Munnangi
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having problem with the trial example given in the first chapter of the HeadFirst EJB book. I followed all the steps for creation/deployment. Now when I am trying to execute the client I am getting a noclassdeffound error or NoSuchMethodError.

I have seen the previous posts about this problem and I tried all possible way but no Luck.

Would appreciate if any one can explain the reason for this error

I have working Folder like

C:\Vishnu\SCBCD\Examples\Example1

12/22/2004 07:32 PM <DIR> .
12/22/2004 07:32 PM <DIR> ..
12/22/2004 06:24 PM 173 Advice.java
12/22/2004 07:05 PM 3,442 AdviceApp.ear
12/22/2004 07:06 PM 21,819 AdviceAppClient.jar
12/22/2004 06:44 PM 817 AdviceBean.java
12/22/2004 08:08 PM 202 AdviceClient.class
12/22/2004 07:07 PM 226 AdviceClient.java
12/22/2004 06:50 PM 187 AdviceHome.java
12/22/2004 06:55 PM <DIR> headfirst

I was able to compile the file AdviceClient.java in both the below ways successfully

javac AdviceClient.java

and

C:\Vishnu\SCBCD\Examples\Example1>java -cp %MYEJB%;AdviceAppClient.jar AdviceClient

Here %MYEJB% is C:\j2sdkee1.3.1\lib\j2ee.jar (MYEJB my System Variable)

I am trying to run the Class file AdviceClient like below

Style 1
========
C:\Vishnu\SCBCD\Examples\Example1>java -cp %MYEJB%;AdviceAppClient.jar;. AdviceClient
Error : Exception in thread "main" java.lang.NoSuchMethodError: main

Style 2
========
C:\Vishnu\SCBCD\Examples\Example1>java -cp C:\j2sdkee1.3.1\lib\j2ee.jar;AdviceAppClient.jar;C:\Vishnu\SCBCD\Examples\Example1 AdviceClient

Error: Exception in thread "main" java.lang.NoSuchMethodError: main

Style 3:
===============
C:\Vishnu\SCBCD\Examples\Example1>java -cp %MYEJB%;AdviceAppClient.jar AdviceClient

Error: Exception in thread "main" java.lang.NoClassDefFoundError: AdviceClient

No luck on any of these trials.

Thanks for any suggestions
 
Eric Benoit
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you see the 'note' from the wickedlysmart.com website?

I don't really know if it's your problem but you can't name the method like the interface name. Your method should be like getTheMessage() instead of getAdvice() because 'Advice' is in the interface name.
 
Archer Sirapas
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this:

java -classpath C:\j2sdkee1.3.\lib\j2ee.jar;AdviceAppClient.jar;C:\Vishnu\SCBCD\Examples\Example1;.; AdviceClient

good luck

let me know if it works or not.
 
Archer Sirapas
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this:

oops not the above. the path to AdviceAppClient.jar is incorrect. Basically you need another path to direct to whatever file in the current dir which needs this only the . syntax.

java -classpath C:\j2sdkee1.3.\lib\j2ee.jar;C:\Vishnu\SCBCD\Examples\Example1\AdviceAppClient.jar;.; AdviceClient
 
Vishnu Munnangi
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's working for me. Thanks for the replys.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic