Adverts

This is a problem that kept a colleague and I going for nearly a whole day which I thought I would share with you. My colleague was starting development of a new web project, using WST, which was dependent on two other projects and would be deployed to Tomcat. We had no problems with building the project but we couldn’t seem to make it work at runtime. No matter what we tried it wouldn’t bring in the other two projects at runtime leading to NoClassDefFound exceptions all over the place.

Since Eclipse handled the build time dependencies correctly I figured it would be able to handle the task of providing those dependencies at runtime too. After much head scratching I finally figured out how to do it. As you might have guessed from the title you need to set the dependent projects as exported for the web project (right click on the web project > Properties > Java Build Path > Order and Export). I only figured this out because Servers shows up as a project and it dawned on me that perhaps WST is treating the Tomcat server (and other defined servers) as just another project.

Having Googled for a solution to this problem quite extensively I can conclude that we are not the only ones that have had problems with this system. I can’t help feeling that it could be a lot clearer as to what is to be provided at runtime. Perhaps what is needed is another option under Properties called Java Runtime Path which specifies what is provided at runtime – this could probably just be the Order and Export tab. The other thing I would like to see is the child libraries (e.g. those in sub-projects) in the Order and Export tab as currently they have to be included in the web project as well as the sub-project.

Adverts

Donate and Help

Please support this site and
Bandwidth doesn't grow on trees y' know :o)

Adverts

Get Adsense