如何通过war文件发送dotx文件-Grails 3.2.13

如何通过war文件发送dotx文件-Grails 3.2.13,grails,apache-poi,war,Grails,Apache Poi,War,我在Grails i18n文件夹中有MS Word文件“template.dotx”,在代码中以以下方式使用: def templateResource = this.class.classLoader.getResource('template.dotx') FileInputStream fis = new FileInputStream(templateResource.file) XWPFDocument template = new XWPFDocument(fis) 从Tomcat

我在Grails i18n文件夹中有MS Word文件“template.dotx”,在代码中以以下方式使用:

def templateResource = this.class.classLoader.getResource('template.dotx')
FileInputStream fis = new FileInputStream(templateResource.file)
XWPFDocument template = new XWPFDocument(fis)
从Tomcat 9上生成的war文件运行应用程序时,最后一行抛出此错误:

e = {IOException@13587} "java.io.IOException: Failed to read zip entry source"
detailMessage = "Failed to read zip entry source"
cause = {ZipException@13595} "java.util.zip.ZipException: invalid block type"
...
在不进一步详细说明的情况下,由于dotx文件已损坏而发生错误。如果我用原始源文件的Windows复制/粘贴来替换扩展的Tomcat dotx文件,那么一切都不会出错。如果我用原始文件替换war文件中的dotx文件,使用7zip插入它,然后让Tomcat扩展war,那么一切都不会出错。在war文件中,有问题的dotx和良好的dotx都显示相同的文件大小,尽管压缩大小略有不同,但CRC不同

因此,war进程本身似乎在压缩过程中破坏了dotx文件。这是一个字符编码问题暴露在战争的文件?我试图解决这个问题但没有成功——为什么只有这个特定的dotx文件——所有其他文件、JAR等都被压缩/扩展而没有问题。使用grails run app运行应用程序也没有问题


我正在使用Intellij,Gradle“war”任务生成war文件。

更多信息。在war文件中,有缺陷的war版本的dotx具有以下属性:主机OS:Unix,特征:UTF8。将工作原始文件粘贴到war I中时,会显示以下属性:主机OS:FAT,特征:NTFS