本文转自:http://blog.csdn.net/lveliu/article/details/77772828

环境搭建为:maven+tomcat

tomcat 8.5.2 以上会出现改问题(包含8.5.2)

开始:

 警告: Failed to scan [file:/D:/develop/repo/xalan/xalan/2.7.2/xercesImpl.jar] from classloader hierarchy
java.io.FileNotFoundException: D:\XXX目录\xalan\xalan\2.7.2\xercesImpl.jar (系统找不到指定的文件。)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:219)
at java.util.zip.ZipFile.<init>(ZipFile.java:149)
at java.util.jar.JarFile.<init>(JarFile.java:166)
at java.util.jar.JarFile.<init>(JarFile.java:130)
at org.apache.tomcat.util.scan.JarFileUrlJar.<init>(JarFileUrlJar.java:60)
at org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:43)
at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:327)
at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:277)
at org.apache.catalina.startup.ContextConfig.processJarsForWebFragments(ContextConfig.java:1887)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1122)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:298)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5093)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1405)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1395)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745) 

虽然只是警告,不影响正常使用,但是看着总是那么不爽。

本人使用过的是maven,我以查看maven依赖,不对啊,怎么会查找这个目录下面的xercesImpl.jar,分明不对,原始路径应该是, D:\XXX目录\xerces\xercesImpl\2.9.1\xercesImpl.2.9.1.jar。

找原因,为什么为加载到D:\XXX目录\xalan\xalan\2.7.2\xercesImpl.jar这个文件,各种百度谷歌,最后找到问题是tomcat 加载包的问题。tomcat在8.5.2 中 修改了加载jar的方式,8.5.2 版本会解析jar中MANIFEST.MF文件,当该文件包含class-path属性时,会把该属性对象值,解析成需要加载的jar给加载进来。这个就是根本原因。没得办法,只有自降版本到8.5.0就能解决这个问题。为了解决这个问题,花了老子半天时间。

例如xalan.jar中MANIFEST.MF文件,部分截图如下:

 

这个就会加载配置的这3个jar,而且寻找路径是xalan.jar所在的文件下寻找。

接下来我们就来看下tomcat的源码,到底是怎么回事。

tomcat 8.5.0 加载jar重要部分如下:

首先调用scanJars扫描jar,重要部分,调用scan方法。

scan方法:

重要部分看红色,这个和8.5.2 版本的方法不一样的地方,这个也是出问题的地方。

先看8.5.0方法:

没有去解析MANIFEST.MF文件。这个正常,接下来我们看8.5.2版本

注意看红色部分

当为jar时,就去调用processManifest该方法,这个方法就是解析MANIFEST文件。下面我们看这个方法:

其中就可以看出,去解析了class-path属性,解析对应值,然后加载到需要classPathUrlsToprocess中,这个就是需要加载的jar对象。所以这个就是根本原因。

不知道tomcat在高版本中为什么要这个做,有知道的同学可以解答下。

xalan\xalan\2.7.2\xercesImpl.jar (系统找不到指定的文件)问题的更多相关文章

  1. springboot: xercesImpl.jar和xml-apis.jar (系统找不到指定的文件)

    springboot内置的tomcat为8.5.23, tomcat在8.5.2 中 修改了加载jar的方式,8.5.2 版本会解析jar中MANIFEST.MF文件,当该文件包含class-path ...

  2. java.io.FileNotFoundException: ...\ibs\library-1.0.17.jar (系统找不到指定的文件。)

    网上找一下相应的jar包,放到对应的路径下就好了

  3. tomcat启动报错:serializer.jar (系统找不到指定的文件。)

    下载最新对应版本的tomcat.移除之前的tomcat.删除原本全部tomcat的目录. 疑似tomcat的lib包被动过.

  4. Android 使用AS编译出错:找不到xx/desugar/debug/66.jar (系统找不到指定的文件。)

    以为是合作人配置文件的问题,后发现是缓存的问题,只需要Clean project,即可. 若提示无法删除目录:Unable to delete directory,或许是因为你打开了另一个项目,只需关 ...

  5. glassfish PWC6351: In TLD scanning 系统找不到指定的文件问题解决

    [2017-04-25T21:26:09.391+0800] [glassfish 4.1] [WARNING] [] [org.apache.jasper.runtime.TldScanner] [ ...

  6. java.io.FileNotFoundException: antlr-2.7.7.jar (系统找不到指定的路径。)[待解决]

    严重: Failed to destroy the filter named [struts2] of type [org.apache.struts2.dispatcher.ng.filter.St ...

  7. 转载:Java项目读取配置文件时,FileNotFoundException 系统找不到指定的文件,System.getProperty("user.dir")的理解

    唉,读取个文件,也就是在项目里面去获得配置文件的目录,然后,变成文件,有事没事,总是出个 FileNotFoundException  系统找不到指定的文件,气死人啦. 还有就是:System.get ...

  8. netbeans 8.2 系统找不到指定的文件。

    系统找不到指定的文件.Using CATALINA_BASE: "C:\Users\wishr\AppData\Roaming\NetBeans\8.2\apache-tomcat-8.0. ...

  9. 未能加载文件或程序集“Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5”或它的某一个依赖项。系统找不到指定的文件。

    在创建ASP.NET MVC项目过程中发生了这个异常 未能加载文件或程序集"Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0 ...

随机推荐

  1. 07.重写ToSting()方法

    namespace _08.重写ToString方法 { class Program { static void Main(string[] args) { Person p = new Person ...

  2. 2017年11月20日 WinForm窗体 窗口无边框可移动&&窗口阴影 控制窗口关闭/最小化

    弹框 MessageBox.Show(); 清空 clear() 字符串拼接 string 公共控件 button 按钮 checkbox 复选框 checklistbox 多个复选框 combobo ...

  3. JAVA常用单词

    柠檬学院Java 基础常见英语词汇(共 70 个)OO: object-oriented ,面向对象 OOP: object-oriented programming,面向对象编程JDK:Java d ...

  4. hdu1385 最短路字典序

    http://blog.csdn.net/ice_crazy/article/details/7785111 http://blog.csdn.net/shuangde800/article/deta ...

  5. 使用mpvue搭建一个初始小程序

    1. 初始化一个 mpvue 项目 现代前端开发框架和环境都是需要 Node.js 的,如果没有的话,请先下载 nodejs 并安装. 然后打开命令行工具: # 1. 先检查下 Node.js 是否安 ...

  6. apply()方法和call()方法

    obj.func.call(obj1)       //是将obj1看做obj,调用func方法,将第一个参数看做函数调用的对象,可以看做,将obj的方法给obj1使用 ECMAScript规范给所有 ...

  7. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:unpack (unpack) on project sq-integral-web: Unable to find artifact.

    1.问题描述 项目maven打包报上述错误, 但是小伙伴运行好使. 2.问题解决 是idea工程编码(gbk)和项目编码(utf-8)不一致 idea->file->Other Setti ...

  8. VC编程操作word2010生成表格

    作者:朱金灿 来源:http://blog.csdn.net/clever101 一.   右键单击工程节点,然后选择添加类,如下图: 二.   添加TypeLib中的MFC类,如下图: 三.   选 ...

  9. mysql创建用户授权

    服务器上好多库,为了不让某用户误操作别人的数据库,给他单独建个用户并授权. insert into mysql.user(Host,User,Password, ssl_cipher, x509_is ...

  10. android popupwindow位置显示

    1.在控件的上方: private void showPopUp(View v) { LinearLayout layout = new LinearLayout(this); layout.setB ...