Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java EJB: The import javax.ejb cannot be resolved

Tags:

java

ejb

I am reading the book Getting Started with WebSphere Application Server Community Edition.

I created an EJB project with Eclipse EE.

import javax.ejb.Local;

Error: The import javax.ejb cannot be resolved

I don't know why I cannot import this class.

Thanks

like image 781
Eric Francis Avatar asked Mar 22 '12 20:03

Eric Francis


2 Answers

Probably the comments under the question already answered this, but just in case clarification is needed:

1) In Eclipse, right click on the project --> properties --> java build path

2) Click on add external JAR

3) Add c:\glassfish4\glassfish\lib\javaee.jar (Your directory path to this JAR can of course be different.)

--> Ok the dialog, and now Eclipse should be able to see javax.ejb.* classes.

like image 190
Daniel Avatar answered Sep 28 '22 07:09

Daniel


Please note that this jar file is useful in development, but you need not (should not?) deploy it along with your war or ear files, because the application server container has its own runtime Java EE environment.

like image 33
Peter Avatar answered Sep 28 '22 06:09

Peter