• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
  • Piet Souris

entity bean compiling error

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried to compile the following code from headfirst ejb the Moviebean code with cmr field and getting error.

package headfirst3;

import javax.ejb.*;
import javax.naming.*;
import java.util.*;
import headfirst3.*;

public abstract class MovieBean implements EntityBean {

private EntityContext context;

public abstract String getMovieID();
public abstract Void setMovieID(String i);

public abstract String getTitle();
public abstract void setTitle(String t);

public abstract String getGenre();
public abstract void setGenre(String g);

public abstract int getYear();
public abstract void setYear(int y);

public abstract Director getDirector();
public abstract void setDirector(Director d);

public String getMovieDirectorName() {
return getDirector().getDirectorName();

public String ejbCreate(String movieID,String title,int year,String genre,String social) throws CreateException {

return null;

public void ejbPostCreate(String movieID,String title,int year,String genre,String social)throws CreateException {

try {

InitialContext ctx =new InitialContext();

DirectorLocalHome dirHome =(DirectorLocalHome) ctx.lookup("java:comp/env/ejb/DirectorLocalHome");
Director dir = dirHome.findByPrimaryKey(social);
catch(Exception ex) {


public void setEntityContext(EntityContext ctx) {
context =ctx;

public void unsetEntityContext() { }
public void ejbLoad() { }
public void ejbStore() { }
public void ejbActivate() { }
public void ejbPassivate() { }
public void ejbRemove() { }

error following
movieBean java:25: cannot resolve symbol
symbol:class Director
Location :class Headfirst3.MovieBean
public abstract Director getDirector();
movieBean java:26: cannot resolve symbol
symbol:class Director
Location :class Headfirst3.MovieBean
public abstract void setDirector(Director d);

moviebean :java:49:cannot resolve symbol
symbol:class directorlocalhome
Location:class headfirst3.MovieBean
DirectorLocalHome dirHome =(DirectorLocalHome) ctx.lookup

MovieBean:java:50:cannot resolve symbol
symbol:class Director
location:class headfirst3.MovieBean
Director dir = dirHome.findByPrimaryKey(social);

Before compile MovieBean i compiled DirectorLocal,DirectorLocalHome and DirectorBean and my classpath %J2EE_HOME%\lib\j2ee.jar;%J2EE_HOME%\lib\locale
DirectorLocalHome interface following

package headfirst3;

import javax.ejb.*;

public interface DirectorLocalHome extends EJBLocalHome {

public DirectorLocal create(String social,boolean oscarwinner,int degrees, String directorname)throws CreateException;

public DirectorLocal findByPrimaryKey(String social)throws FinderException;


Please help me to fix this.
    Bookmark Topic Watch Topic
  • New Topic