In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about how to load XSD files in Spring, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
Org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-2.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not.
Obviously, the xsd file specified in the spring xml configuration file cannot be read, mostly because the network is cut off or the official website of spring is temporarily unable to connect. You can confirm it by entering the URL of the xsd file, such as http://www.springframework.org/schema/beans/spring-beans-2.0.xsd, in the browser.
There are two common solutions to this problem on the Internet. the first is simple and effective, but it takes a lot of work, that is, to convert the xsd path in the form of url in all spring configuration files into a path in the form of classpath pointing to the local xsd file, such as classpath:org/springframework/beans/factory/xml/spring-beans-2.5.xsd. Another way is to set up a web server locally, press URL to create the corresponding folder, and put in the corresponding xsd file. Add "127.0.0.1 www.springframework.org" to the native hosts file. In fact, both methods belong to the "crooked" approach, and we need to start with spring's XSD file loading mechanism to figure out this problem.
First of all: you must know one thing: spring always tries to find xsd files locally when loading xsd files (spring's jar package already contains all versions of xsd files). If it is not found, it will go to the path specified by URL to download. This is a very reasonable approach, and it is not always downloaded from the site as it seems. In fact, if all your configurations are positive, your project can be started when the network is off without reporting the above error. The class that Spring loads the xsd file is PluggableSchemaResolver, you can check its source code to verify the above statement. In addition, you can add to the log4j.xml file:
The above is how to load XSD files in Spring. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.