Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven dependencies not deployed on Eclipse Tomcat instance

I'm using Spring Tool Suite 3.1 and I have some issues deploying a web application to tomcat.

When I hit "run on server" and the server starts it throws the famous:

java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

So I check the /wtpwebapps directory to find that the project is deployed, but inside the lib folder only a few libraries are present. I completely miss the rationale behind their selection. Of course the libraries related to spring aren't there. Can anyone help?

This is my org.eclipse.wst.common.commonent file, maybe it can be useful:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="Checkup">
    <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
    <wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/resources"/>
    <property name="context-root" value="Checkup"/>
    <property name="java-output-path" value="/Checkup/build/classes"/>
</wb-module>

EDIT:

you can see the list of maven plugin embedded with STS installation (no customizations)

STS maven plugins

like image 616
MaVVamaldo Avatar asked Oct 17 '12 09:10

MaVVamaldo


1 Answers

after hours of pain it seems the problem is solved thanks to magics or something. The "mysterious" procedure that fixed the things is the following:

  1. run your project on tomcat and get the error
  2. clean tomcat rclick ---> clean (not clean working directory) while your project is still on the server
  3. run the server again

the tricky part is cleaning tomcat when the web app is still deployed. I really don't know why it works. If you stop the server, remove the application, clean the server and redeploy the application again you get the error. I won't dare to understand further, I accept the mystery.

like image 149
MaVVamaldo Avatar answered Nov 02 '22 13:11

MaVVamaldo