Note that there are some explanatory texts on larger screens.

plurals
  1. POIdea to avoid that spring.handlers/spring.schemas get overwritten when merging multiple spring dependencies in a single jar
    primarykey
    data
    text
    <p>I got the error <code>Unable to locate NamespaceHandler when using context:annotation-config</code> running (java -jar) a jar assembled by the maven-assembly-plugin and containing my project and all its dependencies.</p> <p>As other people correctly spotted on the forum.springsource.org <a href="http://forum.springsource.org/showthread.php?t=48787">thread (message #7/8)</a> the problem occurs because the files <code>META-INF/spring.handlers</code> and <code>META-INF/spring.schemas</code> that are present in different jars, get overwritten when the maven-assembly-plugin repackages the jars in a single file.</p> <p>Looking at the content of two spring-*.jar files you can see the files sits in the same position relatively to the classpath</p> <pre><code>$ jar tf spring-oxm-3.0.3.RELEASE.jar META-INF/spring.handlers META-INF/spring.schemas org/springframework/oxm/GenericMarshaller.class ... $ jar tf spring-context-3.0.3.RELEASE.jar META-INF/spring.handlers META-INF/spring.schemas org/springframework/context/ApplicationContext.class </code></pre> <p>Isn't it is possible to put the META-INF folder in a specific package? If so the idea I'd suggest, (hope it's applicable) is to put the <code>META-INF/spring.shemas</code> and <code>META-INF/spring.handlers</code> files under the package they refer to.</p> <pre><code>$ jar tf spring-oxm-3.0.3.RELEASE.jar org/springframework/oxm/META-INF/spring.schemas org/springframework/oxm/META-INF/spring.handlers org/springframework/oxm/GenericMarshaller.class ... $ jar tf spring-context-3.0.3.RELEASE.jar org/springframework/context/META-INF/spring.handlers org/springframework/context/META-INF/spring.schemas org/springframework/context/ApplicationContext.class </code></pre> <p>This way they won't conflict when merged in a single jar. What do you think about it?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload