Configuration problem:unable to locate Spring Namespacehandler for XML schema namespace workaround

Source: Internet
Author: User

The problem is that when it comes to spring, the local IDE runs normally, but runs the times wrong on the cluster after packaging.

The source of the problem is determined by the multi-party lookup of the data, and the file overwrite occurs because many packages of spring are called in the dependency.

Specifically,

These three files. After viewing, only the TX configuration is left.

Workaround

The first approach is to use MAVEN's packaged plug-in to keep the configuration information for each spring package:

  1. <plugin>
  2. <groupId>org.apache.maven.plugins</groupId>
  3. <artifactid>maven-shade-plugin</artifactid>
  4. <version> 1.7.1</version>
  5. <executions>
  6. <execution>
  7. <phase>package</phase>
  8. <goals>
  9. <goal>shade</goal>
  10. </Goals>
  11. <configuration>
  12. <transformers>
  13. <transformer
  14. implementation="Org.apache.maven.plugins.shade.resource.AppendingTransformer">
  15. <resource>meta-inf/spring.handlers</resource>
  16. </transformer>
  17. <transformer
  18. implementation="Org.apache.maven.plugins.shade.resource.AppendingTransformer">
  19. <resource>meta-inf/spring.schemas</resource>
  20. </transformer>
  21. <transformer
  22. implementation="Org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
  23. <mainClass>com.chenzhou.test.main</mainClass>
  24. </transformer>
  25. </Transformers>
  26. </configuration>
  27. </Execution>
  28. </Executions>
  29. </plugin>

But this approach limits the ability to package only with this Maven plugin, in fact, as long as the three files contain the full configuration information.

The second method is actually very simple, to find these three files, with the three full files I provide can be overwritten.

Typically, these three files are under the meta-inf path under the jar package

Download link for Http://files.cnblogs.com/files/starwater/spring.zip

Configuration problem:unable to locate Spring Namespacehandler for XML schema namespace workaround

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.