ApplicationContext.xml file header error Referenced file contains errors

The problem is as follows: The project that was running normally before suddenly reported an error in the applicationContext.xml file header

Referenced file contains errors (http://www.springframework.org/schema/tx/spring-tx.xsd). For more   information, right click on the message in the Problems View and select “Show Details…”

Reason analysis: If you use Maven to build the project, spring always tries to find the xsd file locally when loading the xsd file (the spring jar package already contains all versions of the xsd file), if it is not found, it will go to the URL to specify The path to download. Therefore, this situation is generally caused by a disconnection or the temporary inability of spring’s official website to connect. You can enter the URL of the xsd file in the browser, for example, in the case of spring-beans, enter http://www.springframework.org/schema/beans/spring-beans-2.0.xsd to confirm.

But this time I didn’t use Maven, the jar packages were all released locally, so the above reasons were ruled out.

Another way of thinking:

1. To make sure that Eclipse can get the xsd file remotely, go to Window -> Preferences ->  General -> Network Connections -> Cache and check whether the required file is correct in the Cache entries box under Cache. If you are not sure, click ” Remove All”, then right-click the current Project and select  Validator, Eclipse will reload the xsd file;

2. The easiest way is to delete the version number of the xsd file (it has been deleted here, but an error is still reported, so method 1 is adopted).

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *