admin管理员组

文章数量:1650765

问题1:严重: Unable to process Jar entry [META-INF/versions/9/module-info.class] from Jar [jar:file:/C:/Users/shenzhenair/Desktop/poice/apache-tomcat-7.0.72/webapps/police/WEB-INF/lib/log4j-api-2.15.0.jar!/] for annotations

**解决方法:系统日志正常使用,但启动报错不好看。原使用Log4J2.83 ,因Log4J2漏洞需修复升级版本到17.1。升级后tomcat-7无法识别log4J导致。使用tomcat-8版本即可。

问题2:ERROR StatusLogger Caught java.lang.AbstractMethodError setting feature http://xml/sax/features/external-parameter-entities to false on DocumentBuilderFactory org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@62b90e0d: java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V

问题3同问题2:ERROR StatusLogger Caught java.lang.AbstractMethodError setting feature http://apache/xml/features/nonvalidating/load-external-dtd to false on DocumentBuilderFactory org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@25e5ecae: java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V

**解决方法:**xercesImpl-2.x.x.jar架包冲突。编译打包时去掉冲突包即可:
下面展示一些 内联代码片

// A code block
       <plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>2.4</version>
				<configuration>
					<source>1.8</source>  
               		<target>1.8</target>  
					<webappDirectory>${project.build.directory}/${project.artifactId}</webappDirectory><!-- 
						<webXml>${project.basedir}/target/jspweb.xml</webXml> -->
					<warName>${project.artifactId}</warName>
					<packagingExcludes>
						WEB-INF/lib/xercesImpl-2.6.2.jar
					</packagingExcludes>
				</configuration>
			</plugin>
![在这里插入图片描述](https://img-blog.csdnimg/25fc849d698047d68b7ee2a87f57fb52.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA6buR55m957-8,size_20,color_FFFFFF,t_70,g_se,x_16)
参考博客:[具体措施无,略蛋疼](https://blog.csdn/yechaodechuntian/article/details/78974894)

## 注意

利用maven的依赖传递性,把xercesImpl-2.x.x.jar用到的版本放在前面,比冲突版本前,这种在maven中看似没问题,逻辑好像也行的通,但是因为最终是在tomcat运行的,tomcat是不知道先后顺序的,所以导致有时候出现有时候不出现的状况。建议使用上面那种编译移除方案。

本文标签: JavalangAbstractMethodErrorErrorStatusLogger