Thursday, January 21, 2016

Cannot find javax.ejb.** in eclipse project

I created an eclipse Project to test simple ejb application.

Then I created simple Session bean. Bean import  " javax.ejb.** " and Annotations.
Eclipse project cannot find the javax.ejb  classes



---------------------------------------------------------------------------------------------

import javax.ejb.LocalBean;
import javax.ejb.Stateless;

/**
 * Session Bean implementation class Addition
 */
@Stateless
@LocalBean
public class Addition implements AdditionRemote {

    /**
     * Default constructor.
     */
    public Addition() {
        // TODO Auto-generated constructor stub
    }

}

--------------------------------------------------------------------------------------------------

Solution:
Need to add a jar which has above classes
I have downloaded glassfish. Glassfish is a server use to run ejb. So it has ejb support jars with in it
Add "javaee.jar" as an external jar

Steps
------
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.)

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


No comments:

Post a Comment