daveslab
daveslab

Reputation: 10310

Eclipse not publishing Spring XML files into Tomcat?

So this is a bit of a confusing issue for me to describe, but easy to undergo unfortunately. I have a project created with Maven 2, that I have in Eclipse 3.7. I'm using Spring 2.5 I'm publishing the app I'm writing to Tomcat 7 inside of the Eclise "Servers" tab. The weird thing is that I'll run the server and it won't find any of the *.spring.xml files in the classpath. These files are located in a src/main/resources folder.

I thought initially that my pom.xml file was wrong, but when I run with mvn jetty:run-war it runs perfectly fine. In fact, if I run mvn clean install on the Terminal and then hit "Refresh" in Eclipse, it does work in Tomcat just fine! It's when I run "Clean" in Eclipse (as in "Project -> Clean") that it stops working again.

I've found many forum threads that 70% similar but not quite exactly my situation. Any ideas?

PS I'm using Mac OS X Lion

PPS Here is the exact error I get on startup:

Caused by: java.io.FileNotFoundException: class path resource [common.spring.xml] cannot be opened because it does not exist

Upvotes: 0

Views: 988

Answers (2)

Dave Newton
Dave Newton

Reputation: 160181

Make sure the resources folder is listed as a source folder in eclipse so the resources will be included in the classpath and deployed.

Upvotes: 1

Gabriel Belingueres
Gabriel Belingueres

Reputation: 2975

Try putting the Spring's XML files in the following directory:

src/main/webapp/WEB-INF

Upvotes: 0

Related Questions