• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

stuck early on in HF EJB

 
christopher gray
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

I have just started studying java programming again after a long spell working in network support and I am trying to get my head around ejb and j2ee concepts in general using the Headfirst ejb book, which seems very good however I am having some difficulty at the end of the first chapter.

I know this is a popular book here and I was wondering if someone could help me out?

I have deployed the AdviceApp bean successfully which created AdviceAppClient.jar and AdviceApp.ear in the Advice folder.

I then attempted to compile the client using AdviceClient.java from the Advice folder however I got this compiler error, where it does not find the headfirst package.

AdviceClient.java:4: package headfirst does not exist
import headfirst.*;
^
AdviceClient.java:5: package javax.ejb does not exist
import javax.ejb.*;
^
AdviceClient.java:18: cannot resolve symbol
symbol : class AdviceHome
location: class AdviceClient
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o, Advice
Home.class);
^
AdviceClient.java:18: cannot resolve symbol
symbol : class AdviceHome
location: class AdviceClient
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o, Advice
Home.class);
^
AdviceClient.java:18: cannot resolve symbol
symbol : class AdviceHome
location: class AdviceClient
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o, Advice
Home.class);
^
AdviceClient.java:20: cannot resolve symbol
symbol : class Advice
location: class AdviceClient
Advice advisor = home.create();
^
6 errors
 
Lakshmi Saradha
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christopher,

I visited the forum to post this question and saw your post.

I guess somebody would help us.
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christopher,

Please check to see if your ejb-jar file is inside the classpath? Also, if you're using the RI (most probably), please do a search on the forum, there'd been quite a few posts on common problems faced on getting the Advice bean to work.

Lastly, do check out the Official HFEJB website for its errata, solutions & tips.

HTH.
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check your classpath, your dir structure should look like this:

AdviceProject
-- AdviceClient.java
----> headfirst
------ AdviceBean.class
------ AdviceHome.class
------ Advice.class

Ensure the j2ee.jar is in your classpath before compiling.
 
Lakshmi Saradha
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the j2ee.jar file in the classpath and also the ejb-jar file in the class path. But I get the same error.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic