java – 为什么FileSystemXmlApplicationContext会对存在的文件
发布时间:2020-12-15 00:03:08 所属栏目:Java 来源:网络整理
导读:我正在运行以下代码: 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
我正在运行以下代码:
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 并查看其内容. 任何人都可以建议这里有什么问题吗? 解决方法
尝试使用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警告 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |