I have different XML-files in my ‘src/main/recources’ folder, and I’d like to read them from my webapplication.
File f = new File("file1.xml");
f.getAbsolutePath();
The code gets invoked inside a WebService, and this prints out ‘C:\Users\Administrator’ when I look inside the Tomcat-server-output. My current solution is to put the ‘file1.xml’-documents outside of the WAR, in the ‘C:\’-folder but this way my WAR is not transferable.
I’ve also tried
<bean name="webService">
<property name="document">
<value>classpath:file1.xml</value>
</property>
</bean>
But that just prints out the “classpath:file.xml” without parsing it.
Regards,
Pete
If you are using the standard maven2 war packaging, your file1.xml is copied to the directory WEB-INF/classes within your warfile.
You can access this file via the classpath.