Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

HFEJB- Page57 - AdviceClient

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's working for me. Thanks for the replys.
 
Oh the stink of it! Smell my tiny ad!
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic