aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes having issues with compile for AdviceBean from HF EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "having issues with compile for AdviceBean from HF EJB" Watch "having issues with compile for AdviceBean from HF EJB" New topic
Author

having issues with compile for AdviceBean from HF EJB

roger vengunta
Greenhorn

Joined: May 24, 2010
Posts: 2
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.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You need to include the J2EE jar file to your classpath. The JAR file should be somewhere in your EJB container directory.


[My Blog]
All roads lead to JavaRanch
roger vengunta
Greenhorn

Joined: May 24, 2010
Posts: 2
@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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: having issues with compile for AdviceBean from HF EJB