我正在运行以下代码:
new FileSystemXmlApplicationContext("/data/farm/Server/confData/1000004/contex.xml")
并抛出
java.io.FileNotFoundException: class path resource [data/farm/Server/confData/1000004/contex.xml] cannot be opened because it does not exist
该文件存在,我可以做
cat /data/farm/Server/confData/1000004/contex.xml
并看到它的内容。 此外在Windows中这个代码工作 – 问题是在linus(我有Ubuntu的操作系统)
任何人都可以build议这里有什么问题吗?
尝试使用Url创建FileSystemXmlApplicationContext,如:
new FileSystemXmlApplicationContext("file:/data/farm/server/confData/1000004/contex.xml");
有关进一步的解释,请参阅: http ://static.springsource.org/spring/docs/3.0.0.M3/spring-framework-reference/html/ch05s07.html 5.7.3 FileSystemResource警告