Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • 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

having issues with compile for AdviceBean from HF EJB

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I just got the headfirst EJB book (was pumped up the reading the first few pages) and then it's been downhill since!

First, I couldn't find the tool in the RI to build the xml file. I brushed that aside (not wanting to dampen my hyper amped spirit) and coded by hand and created the xml file.

Then I created the directory structure exactly the way it's described in the book. So we're still good at this point.

Then the troubles begin. I tried compiling the classes using javac -d ../classes headfirst/*.java to compile the three java class files. I get a javac is not a symbol error so I explicitly set the path variable and tried again. No dice. Here's the error I get:

headfirst\Advice.java:3: package javax.ejb does not exist
import javax.ejb.*;
^
headfirst\Advice.java:7: cannot find symbol
symbol: class EJBObject
public interface Advice extends EJBObject {
^
headfirst\AdviceBean.java:3: package javax.ejb does not exist
import javax.ejb.*;
^
headfirst\AdviceBean.java:5: cannot find symbol
symbol: class SessionBean
public class AdviceBean implements SessionBean {
^
headfirst\AdviceBean.java:28: cannot find symbol
symbol : class SessionContext
location: class headfirst.AdviceBean
public void setSessionContext(SessionContext ctx) {
^
headfirst\AdviceHome.java:3: package javax.ejb does not exist
import javax.ejb.*;
^
headfirst\AdviceHome.java:7: cannot find symbol
symbol: class EJBHome
public interface AdviceHome extends EJBHome {
^
headfirst\AdviceHome.java:9: cannot find symbol
symbol : class CreateException
location: interface headfirst.AdviceHome
public Advice create() throws CreateException, RemoteException;
^
8 errors


My attempt at solving this has been on the lines of trying to figure out what classpath needs to be set and what path variables need to be set and I tried a combination of all those without success. I've got 2 javac.exe files - one that is in my java\jdl1.6.0_15\bin directory and another one that is with the Sun\AppServer\jdk\bin folder so I explicitly tried setting the path var to the first one and then the second but didn't work. Also, I'm on windows 7 os with 64 bit. Could this be an issue? Either way, I've hit a brick wall and obviously, the wall is winning.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to include the J2EE jar file to your classpath. The JAR file should be somewhere in your EJB container directory.
 
roger vengunta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Cristophe:

Yes, I did set the classpath variable to the folder that has the j2ee.jar. Here is what I did:

C:\Users\roger>set CLASSPATH=C:\Sun\AppServer\lib (this is where I have the j2ee.jar)

C:\Users\roger>set PATH=%PATH%;C:\Program Files\Java\jdk1.6.0_15\bin (this is where I have the javac.exe file)

C:\Users\roger>cd projects

C:\Users\roger\projects>cd advice

C:\Users\roger\projects\advice>cd src\headfirst (here is the folder with all my advice bean java classes)

C:\Users\roger\projects\advice\src\headfirst>javac -d ../classes headfirst/*.java (this is to compile those classes and put the .class files in the classes folder, but I get the following error)
javac: file not found: headfirst\*.java
Usage: javac <options> <source files>
use -help for a list of possible options
 
Beauty is in the eye of the tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic