File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes HFEJB- Page57 - AdviceClient Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "HFEJB- Page57 - AdviceClient " Watch "HFEJB- Page57 - AdviceClient " New topic
Author

HFEJB- Page57 - AdviceClient

Vishnu Munnangi
Ranch Hand

Joined: Sep 28, 2004
Posts: 114
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

Joined: Apr 11, 2002
Posts: 13
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.


Eric Benoit<br /> <br />SCJP 1.4<br />SCWCD 1.3<br />SCBCD 1.3 (in progress)
Archer Sirapas
Greenhorn

Joined: Dec 04, 2004
Posts: 8
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

Joined: Dec 04, 2004
Posts: 8
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

Joined: Sep 28, 2004
Posts: 114
It's working for me. Thanks for the replys.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HFEJB- Page57 - AdviceClient
 
Similar Threads
Class not found error when running the trial example from Headfirst book
problem on hfejsb page 57
Error compiling the AdviceClient.java
(hd first SCBD) NoClassDefFoundError: /util/JDKBridge
Anyone could hel for this HEAD FIRST runing AdviceClient : Exception in thread "main