Problem Solving Spring java project execution "can not read the plan document ...", ";; 2) can not read the document root element 3) the document is not a reason ... 1) not find the document" appears after packing

problem

A java project built using Spring, Eclipse normal operation or idea. Why run the following error occurs after packaging it?

2019/07/10/19:04:07 WARN  [main] org.springframework.util.xml.SimpleSaxErrorHandler.warning(SimpleSaxErrorHandler.java:48) - Ignored XML validation warning
org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 76; schema_reference.4: 无法读取方案文档 'http://www.springframework.org/schema/beans/spring-beans.xsd', 原因为 1) 无法找到文档; 2) 无法读取
文档; 3) 文档的根元素不是 <xsd:schema>。
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaWarning(Unknown Source)
 ....

Cause Analysis

Spring Series dependencies because we use: spring-beans, spring-context, spring-aop, spring-jdbc, spring-tx, etc. which are part of the configuration file of the same name: spring.facotries, spring.handlers, spring.schemas, spring.tooling.

spring-beans bag deployment Pictures

spring-context bag deployment Pictures

spring-aop bag deployment Pictures

spring-jdbc bag deployment Pictures

spring-tx bag deployment Pictures

During the process of packaging, packaging plug-ins if there is no detailed configurations, these configuration files with the same name will be placed in the same directory, the file may be replaced by the same name, will finally formation profile insufficiency.

Solution

The configuration information for all configuration files manually merge. Then the project jar package directory \ These four files in the META-INF replaced with a good file merge.

Here I provide a good four have been merged file (Note: This document is for Spring4.2 and below the high need their own version merger) of Download:
Link: https://pan.baidu.com/ s / 1MXvpuwzgY-qfVYwJeveb_Q extraction code: keh4

Test runs, normal.

Guess you like

Origin www.cnblogs.com/steven0325/p/11166020.html