Labels

Monday, October 14, 2013

Runtime ClassNotFoundExceptions may result

Problem:

When using Eclipse Kepler to create Java EE projects, I was getting the following warnings:

Classpath entry <jar library here> will not be exported or published.  Runtime ClassNotFoundExceptions may result.

Solution:

The warning is telling me that the jar file (in my case it was a log4j library) will not be included in the archive that is deployed to application server.  This warning is just a reminder that unless you put the jar file in the classpath of the application server you will receive ClassNotFoundExceptions when trying to run the projects.  A very handy reminder but somewhat irritating since I don't like the little yellow triangle with exclamation point that appears on the project because of the warning.  The can be fixed by adding the jar file for the required library to the Deployment Assembley (Project Properties -> Deployment Assembly -> Add... -> Java Build Path Entries -> <jar library>).  The downside to this is that the jar will be included in the EAR or WAR that is generated thus making is much larger.