Wednesday 11 July 2012

The Java EE server classpath is not correctly set up - server home directory is missing.

I received this error when running 'clean dist' for my Java web application from Jenkins but it can also occur in NetBeans:

The Java EE server classpath is not correctly set up - server home directory is missing.
Either open the project in the IDE and assign the server or setup the server classpath manually.
For example like this:
ant -Dj2ee.server.home=<app_server_installation_directory>

The solution I found for this was to add this line to nbproject/project.properties:

j2ee.server.home=http://localhost

After this change the build was successful.