में काम नहीं करता यहाँ परिदृश्य है:xi: जार फ़ाइल में xml फ़ाइल में शामिल WildFly
मैं कई .xml
(एक विन्यास की कुछ हद तक) अपने आवेदन एक .jar
फ़ाइल में चलाने के लिए के लिए आवश्यक फ़ाइलों बंडल।
settings-1.0.0.jar
˪ resources/
˪ 1.xml
˪ 2.xml
˪ 3.xml
˪ META-INF/
˪ MANIFEST.MF
1.xml
निम्नलिखित सामग्री है:: जार फ़ाइल निम्न संरचना है
<?xml version="1.0" encoding="UTF-8"?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- Include 2 -->
<xi:include
href="resource:resources/2.xml" />
<!-- Include 3 -->
<xi:include
href="resource:resources/3.xml" />
<!--
<map>
</map>
-->
</document>
this लेख पर आधारित है। जब इन में शामिल हैं का उपयोग करने की कोशिश कर (सफलतापूर्वक के बाद अपने आवेदन की तैनाती) मैं निम्नलिखित त्रुटि मिलती है:
Caused by: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 43; An 'include' failed, and no 'fallback' element was found.
at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:245)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:298)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
at org.zcore.dkp.backend.mapper.MappingParser.parse(MappingParser.java:60)
... 327 more
मैंने कोशिश की (& error'd) सभी विचारणीय विकल्प। xi:include
'.xml
फ़ाइल jar
-File में WildFly मॉड्यूल के रूप में स्थापित करने के लिए सही संयोजन क्या है?
संपादित: यहां बताया xmlfile भरी हुई है है:
private void loadBackendMapping() {
try {
BackendMappingParser parser = new BackendMappingParser();
InputStream in = ResourceLoaderHelper.getResourceAsStream(BACKEND_MAPPING_RESOURCE);
if (in == null) {
throw new FileNotFoundException();
}
try {
parser.parse(in);
} finally {
try {
in.close();
} catch (IOException e) {
log.warn("Failed to close " + BACKEND_MAPPING_RESOURCE, e);
}
}
backendMapping = parser.getMapping();
if (log.isDebugEnabled()) {
log.debug(BACKEND_MAPPING_RESOURCE + " successfully loaded!");
}
} catch (FileNotFoundException e) {
log.warn("\"" + BACKEND_MAPPING_RESOURCE + "\" not found!");
backendMapping = new BackendMapping();
} catch (Exception e) {
throw new CenterwareSystemException("Failed to parse " + BACKEND_MAPPING_RESOURCE, e);
}
}
BACKEND_MAPPING_RESOURCE
फ़ाइलनाम (1.xml
) शामिल हैं।
आपके उपयोग के मामले में क्या है? क्या जार फ़ाइल में अपनी सेटिंग्स को पैकेज करना वाकई आवश्यक है? –
http://stackoverflow.com/questions/8412798/how-to-load-xmlcatalog-from-classpath-resources-inside-a-jar-reliably देखें कि यह –
में मदद करता है या नहीं, क्या आप वह कोड दिखा सकते हैं जिसका उपयोग आप बनाने के लिए करते हैं पार्सर/नक्शाकार? – ctomc