• 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

stuck early on in HF EJB

 
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
 
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.
 
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.
 
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.
 
He does not suffer fools gladly. But this tiny ad does:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic