Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring 3 NamespaceHandler issues with Maven Shade plugin

Spring 3.1.1.RELEASE with Apache Maven 3.0.3 and Maven Shade plugin 1.6.

Using the mvn shade plugin to package the artifact in an uber-jar, including its dependencies:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>1.6</version>
    <executions>
        <execution>
        <phase>package</phase>
        <goals>
            <goal>shade</goal>
        </goals>
        <configuration>
            <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                    <mainClass>com.MyApplication</mainClass>
                </transformer>
            </transformers>
        </configuration>
    </execution>
</executions>

Seems to package just fine but on execution complains of Spring NamespaceHandler issues:

Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/util]
Offending resource: class path resource [spring/test-context.xml]

This applies to both the util and p-namespaces, but expect it's not limited to these:

xmlns:util="http://www.springframework.org/schema/util"
xmlns:p="http://www.springframework.org/schema/p"

If I rewrite the property or list (util) longhand the issues disappear.

like image 496
Andrew Eells Avatar asked May 14 '12 13:05

Andrew Eells


1 Answers

Try adding an AppendingTransformer to your config. The example specifically mentions this as being useful for Spring handlers.

like image 134
user944849 Avatar answered Nov 03 '22 19:11

user944849