`

关于 Unable to locate xxx NamespaceHandler for XML schema namespace

阅读更多

遇见的 Unable to locate xxx NamespaceHandler for XML schema namespace 相关问题以后,目前总结主要有两种情况:

1.  非spring的xml Schema报错

     这时候根据遇见的两次错误,基本上可以定位为缺少pom的依赖。因为有相应的jar包依赖,就会自动下载相关的xsd文件并且打包到jar文件中。

 

2. 遇见 spring的xml Schema报错

    如果已经配置了spring的相关pom依赖,则基本上是由于在进行打包配置时的maven插件问题造成的。放弃assembly的打包方式,而换用shade方式,在pom中的配置如下:

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/spring.handlers</resource>
                                </transformer>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/spring.schemas</resource>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

 

 

1
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics