簡體   English   中英

應用程序無法使用One-Jar查找XSD文件

[英]Application fails to find XSD file using One-Jar

我正在使用One-Jar的maven插件將Java及其所有依賴項打包到一個jar中。

該項目有一個名為schema.xsd的資源。

當我使用java -jar myJar.one-jar運行jar文件時,出現以下錯誤:

 org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document
 'jar:file:/../lib/myJar.one-jar.jar!/lib/myJar.jar!/schema.xsd', because 1) could not find 
the document; 2) the document could not be read; 3) the root element of the document is not 
<xsd:schema>.

知道為什么會這樣嗎?

注意:應用程序將log4j.properties作為資源,它可以識別它。

我很確定jre中的Jar url連接處理實現不能處理多個嵌套(該url中包含2個'!'字符)。 不確定one-jar如何處理從嵌套jar中讀取類文件,但是您可能需要先將xsd提取到臨時文件,然后才能使用它。

就個人而言,我通常將Maven程序集插件與“ jar-with-dependencies”目標一起使用,除非您在一個或多個jar中有沖突的文件,否則該插件就可以正常工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM