java

关注公众号 jb51net

关闭
首页 > 软件编程 > java > spring boot xalan 引入报错

spring boot中xalan引入报错系统找不到指定的文件原因分析

作者:wdd668

这篇文章主要介绍了spring boot中xalan引入报错系统找不到指定的文件,主要原因是内嵌的tomcat9.0.36,本文给大家分享最新解决方法,需要的朋友可以参考下
2023-08-11 09:17:30.913  WARN 9664 --- [  restartedMain] o.a.tomcat.util.scan.StandardJarScanner  : Failed to scan [file:/D:/softout/mavenrepo/xalan/xalan/2.7.2/serializer.jar] from classloader hierarchy
java.io.FileNotFoundException: D:\softout\mavenrepo\xalan\xalan\2.7.2\serializer.jar (系统找不到指定的文件。)
	at java.util.zip.ZipFile.open(Native Method) ~[na:1.8.0_251]
	at java.util.zip.ZipFile.<init>(ZipFile.java:225) ~[na:1.8.0_251]
	at java.util.zip.ZipFile.<init>(ZipFile.java:155) ~[na:1.8.0_251]
	at java.util.jar.JarFile.<init>(JarFile.java:167) ~[na:1.8.0_251]
	at java.util.jar.JarFile.<init>(JarFile.java:131) ~[na:1.8.0_251]
	at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:221) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.tomcat.util.scan.JarFileUrlJar.<init>(JarFileUrlJar.java:65) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:49) ~[tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:383) [tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.tomcat.util.scan.StandardJarScanner.processURLs(StandardJarScanner.java:318) [tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.tomcat.util.scan.StandardJarScanner.doScanClassPath(StandardJarScanner.java:270) [tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:233) [tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.jasper.servlet.TldScanner.scanJars(TldScanner.java:262) [tomcat-embed-jasper-9.0.36.jar:9.0.36]
	at org.apache.jasper.servlet.TldScanner.scan(TldScanner.java:104) [tomcat-embed-jasper-9.0.36.jar:9.0.36]
	at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:83) [tomcat-embed-jasper-9.0.36.jar:9.0.36]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5128) [tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) [tomcat-embed-core-9.0.36.jar:9.0.36]
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) [tomcat-embed-core-9.0.36.jar:9.0.36]

spring boot  2.2.8.RELEASE 引入 xalan会报上面的错  加入这个配置

原因 内嵌的tomcat9.0.36

tomcat在8.5 中 修改了加载jar的方式,8.5 版本会解析jar中MANIFEST.MF文件,当该文件包含class-path属性时,会把该属性对象值,解析成需要加载的jar给加载进来。

@Bean
public TomcatServletWebServerFactory tomcatFactory(){
    return new TomcatServletWebServerFactory(){
         @Override
         protected void postProcessContext(Context context) {
             ((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
         }
    };
}

到此这篇关于spring boot中xalan引入报错系统找不到指定的文件的文章就介绍到这了,更多相关spring boot xalan 引入报错内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

您可能感兴趣的文章:
阅读全文