0
我正面臨一個奇怪的問題。我正在嘗試創建一個XML模式以驗證文件。我做我的功能如下:Jenkins引發的SAXException
String schemaFilename = ApplicationConfiguration.xsdConfiguration.getTypeMappings().get(fileType);
ClassLoader classLoader = getClass().getClassLoader();
File schemaFile = new File(classLoader.getResource(ApplicationConfiguration.xsdConfiguration.getXsdSchemasLocation()+schemaFilename).getFile());
final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = null;
try
{
schema = schemaFactory.newSchema(schemaFile);
}
catch (SAXException e) {
logger.error("Could not instantiate XSD schema from file: {}", schemaFile.getName());
e.printStackTrace();
validXML = false;
}
當我運行無論是通過的IntelliJ或通過Maven的這一切工作正常我在Windows上的測試。當我試圖建立在詹金斯,在CentOS運行我得到SAXExceptions(編輯堆棧跟蹤)
org.xml.sax.SAXParseException; systemId: file:/...myfile.xsd; lineNumber: 48; columnNumber: 39; src-resolve: Cannot resolve the name 'AnElement' to a(n) 'type definition' component.
什麼可能會錯誤的任何想法?