Don’t forget your resources directory! (Maven/Eclipse/Sysdeo-tomcat)

Recently I had to set up a XMLRPC Server. Using Apache’s XMLRPC it should not be that hard to set up.

It wasn’t. But it did not work the first time.

The XMLRPC Serlvet would not be initialized properly because it could not find the XmlRpcServlet.properties file. I was a bit suprised, because I had it in my src/main/org/apache/xmlrpc/webserver path… so why did it not work?

The reason is that whenever you run your Tomcat webserver, configured to look into your project directory (using the tomcat-sysdeo maven plugin) which is set up using maven; you’ll be using your classpath as set up there. If you look into your project->build path settings (tab source), you’ll see that everything under src/main is only including **/*.java, meaning it will not find the properties file at all!

Once I moved the XmlRpcServlet.properties to src/main/resources/org/apache/xmlrpc/webserver (where it belongs), it worked fine.

So remember, classpath, classpath, classpath!