【发布时间】:2012-06-30 19:45:07
【问题描述】:
我在 .xml 文件中有与数据库连接相关的属性。我想在 .properties 文件中使用相同的值。是否可以从 .xml 文件中获取值并设置为 .properties?
-- 谢谢
使用 loadFromXML
时出现异常线程“main”中的异常 java.util.InvalidPropertiesFormatException:org.xml.sax.SAXException:无效的系统标识符:http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd 在 java.util.XMLUtils.load(XMLUtils.java:76) 在 java.util.Properties.loadFromXML(Properties.java:868) 在 com.generalsentiment.test.quartz.CronTriggerExample.run(CronTriggerExample.java:40) 在 com.generalsentiment.test.quartz.CronTriggerExample.main(CronTriggerExample.java:117) 原因:org.xml.sax.SAXException:无效的系统标识符:http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd 在 java.util.XMLUtils$Resolver.resolveEntity(XMLUtils.java:190) 在 org.apache.xerces.util.EntityResolverWrapper.resolveEntity(未知来源) 在 org.apache.xerces.impl.XMLEntityManager.resolveEntity(未知来源) 在 org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(未知来源) 在 org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(未知来源) 在 org.apache.xerces.parsers.XML11Configuration.parse(未知来源) 在 org.apache.xerces.parsers.DTDConfiguration.parse(未知来源) 在 org.apache.xerces.parsers.XMLParser.parse(未知来源) 在 org.apache.xerces.parsers.DOMParser.parse(未知来源) 在 org.apache.xerces.jaxp.DocumentBuilderImpl.parse(未知来源) 在 java.util.XMLUtils.getLoadingDoc(XMLUtils.java:102) 在 java.util.XMLUtils.load(XMLUtils.java:74) ... 3 更多 Java 结果:1
【问题讨论】:
标签: java xml properties