By the time, you should include the Java EE API in the build path of the project. The Java EE API is essentially an application server, such as, for example, Oracle Glassfish.
In Eclipse, open the Servers view in the lower right box. If not, then you need to add it. Right-click and select Create. The wizard must speak for himself. If there is no option for Sun or Oracle Glassfish, you need to install the Eclipse plugin separately. In newer versions of Eclipse, you can do this by clicking on βDownload additional server adaptersβ at the top of the wizard, and then selecting one of the Oracle Glassfish Server tools. If in an older version of Eclipse you need to install it manually according to the instructions on the home page .
After the server is integrated into Eclipse (or actually already exists), you should right-click on the dynamic web project and go to the Target battery life section. Select the integrated server there. Rebuild if necessary.
source share