java - Maven shade unable to locate Spring NamespaceHandler for XML schema namespace

Stack Overflow · · 250 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

I've a small Spring project, that I've booted up with roo 1.2.2

I can run the main class just fine within Eclipse Juno. However when I try to run the JAR file built with mvn package, I get the following error:

Exception in thread "main" 
Configuration problem: Unable to locate Spring NamespaceHandler for 
    XML schema namespace []
Offending resource: class path resource [META-INF/spring/applicationContext.xml]

I am using Maven shade plugin to build the uber JAR, with the following configuration:

                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">

In the pom.xml properties I have <spring.version>3.1.2.RELEASE</spring.version> and one of the dependencies is:


The application context header is as follows:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns=""
    xsi:schemaLocation="                                ">

In my main program I have:

String[] springConf = new String[] { "META-INF/spring/applicationContext.xml",
    "META-INF/spring/watcher.xml" };
BeanFactory appContext = new ClassPathXmlApplicationContext(springConf);

When I type mvn package I get

[INFO] Building jar: /home/stivlo/workspace/monitor/target/monitor-0.1.0.BUILD-SNAPSHOT.jar
[INFO] --- maven-shade-plugin:1.7.1:shade (default) @ monitor ---
[INFO] Including org.springframework:spring-tx:jar:3.1.2.RELEASE in the shaded JAR.

Anyone can suggest what I am missing and how to fix my build so that I can run my JAR?

250 次点击  
加入收藏 微博
1 回复  |  直到 2020-12-11 11:19:33
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传