views:

16

answers:

3

I have installed Eclipse for Java EE and the Java EE SDK from Sun, and am attempting to create (my first) Java EE application.

I've created an EJB project, then added a session bean using Eclipse's own wizards, and the package javax.ejb isn't found!

I've configured the Java EE SDK as the target runtime environment, and a JDK 1.6 as the JRE.

What is going on!? Where does this package come from if not from the JEE SDK or Eclipse for Java EE developers!

Many thanks

A: 

I assume you have WTP with Java EE development tools for Eclipse. In project properties, select Project Facets, make sure you have added one of J2EE runtimes with EJB support (e.g. JBoss) and then enable EJB Module facet for your project. you can also create an EJB project using File / New... / Project / EJB Project wizard, though you will still have to add your EJB runtime, e.g. download and install JBoss server.

Eugene Kuleshov
A: 

I couldn't reproduce your issue. I generated a test EJB Project using GlassFish (that's what you get in the Java EE SDK, right?) as Target runtime:

alt text

And the project definitely includes javax.ejb classes as dependency:

alt text

Pascal Thivent
A: 

Thanks for the help guys. Yes, it would appear that Glassfish is included with the Java EE SDK (though this wasn't immediately apparent). I think the issue was that targeting this as the runtime didn't bring through the libraries correctly (possibly you need to select the 'glassfish' subfolder within the installation - though there was no kind of warning that this hadn't worked).

As Pascal mentions, I downloaded and installed Glassfish 3 itself and a Glassfish 'server adapter' (available when adding a new server runtime environment). Now, when targeting the Glassfish runtime environment, it prompted me to select the glassfish subfolder and hence now it works.

Thanks for the help, this is a steep learning curve... :)

Dave