Note that there are some explanatory texts on larger screens.

plurals
  1. POClassNotFoundException DispatcherServlet when launching Tomcat (Maven dependencies not copied to wtpwebapps)
    text
    copied!<p>I've run into this problem a few times and only just stumbled upon a (semi-) reliable solution, so thought I would post it here in case it helps anyone else, or in case I forget it, and also to ask if anyone has any idea what the underlying cause is and why my fix works.</p> <p>The problem - I have a spring 3 webapp that I want to use the Run on Server option in Eclipse to run on a Tomcat 7 server. With some projects this just works, but some seem to get in a broken state whereby every time the server starts up I get a class not found: org.springframework.web.servlet.DispatcherServlet.</p> <p>After some investigation I found out that the project's maven dependencies had not been copied to <code>WEB-INF/lib</code> in <code>${PROJECT_LOCATION}/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/</code></p> <p>I tried a lot of things before finally noticing that the project had a warning in the Problems panel:</p> <pre><code>Classpath entry org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result. </code></pre> <p>Perhaps I should have noticed this sooner.</p> <p>Anyway, selecting this and performing the "Quick Fix" fixes the issue and I can happily run my project. The quick fix is to: "Mark the associated raw classpath entry as a publish/export dependency".</p> <p>Trouble is, although this works, I don't know what it means. I can't see any obvious changes in my project configuration after it's done. I would quite like to know what the actual problem is and if I can avoid it happening again. I would also like to know if there is something I could have done myself (other than performing the quick fix) that would have fixed it, because I feel like I tried pretty much everything else.</p> <p>Thanks for your help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload