Some necessary libraries are missing in WAR-File after export from Eclipse - why?

Stephan picture Stephan · Aug 20, 2010 · Viewed 11.7k times · Source

I took over a project of a college which contains some web services and by exporting the project as WAR-file some libraries are contained in the file (e.g. Axis2) and some aren’t (hibernate, JDBC driver). Also a jar which is added to the class path has not been exported. All libraries are located in folders on the hard drive which means that they are not in located somewhere in the eclipse folder. If I open the WAR-file after export with WinRAR and add the libraries manually to the file the web service will work well but that is not a good solution… What could be the reason for that problem? And how can I solve it?

Answer

Thorbjørn Ravn Andersen picture Thorbjørn Ravn Andersen · Aug 20, 2010

The jar dependencies for Eclipse to include in a war file not placed in WEB-INF/lib is not managed by the usual "project export/imports" but by a separate panel (3.6: Deployment Assembly, 3.5: Java EE Module Dependencies) in the preferences of the dynamic web project.

alt text

Note: Since the answer was originally written, Maven has become the defacto packaging tool. Instead of relying on Eclipse features, I would strongly recommend to use Maven packaging instead. It has the additional benefit of making the project instantly usable with all modern IDE's.