The workaround for starting the Times wrong spring error with the standalone executable jar package assembly

Source: Internet
Author: User

project Development using Dubbo, want to make the service executable jar package, and all the dependencies are packaged into this jar file, the project relies on the use of spring, etc., after the use of MAVEN assembly packaged into a standalone executable jar package, in the execution times the following error:
Configuration problem:unable to locate Spring Namespacehandler for XML schema namespace
This issue is also mentioned on the Internet, which is a bug in assembly. See: Http://jira.codehaus.org/browse/MASSEMBLY-360 The reason is that many of the jar packages in spring contain spring.handlers and Spring.schemas files, and assembly will only break the first encountered file into the jar package, which will be missed later.
       the solution is to give up assembly, Use the shade plug-in to package. Specifies that spring.handlers and spring.schemas files are added append in the shade packaging configuration to ensure that the information of the two files in other spring jars is not omitted. Here is an example of a configuration:

     <plugin><groupId>org.apache.maven.plugins</groupId>< artifactid>maven-shade-plugin</artifactid><version>1.4</version><executions>< execution><phase>package</phase><goals><goal>shade</goal></goals>< Configuration><transformers><transformerimplementation= " Org.apache.maven.plugins.shade.resource.ManifestResourceTransformer "><mainClass> Activiti.server.deploy.server</mainclass></transformer><transformerimplementation= " Org.apache.maven.plugins.shade.resource.AppendingTransformer "><resource>meta-inf/spring.handlers</ Resource></transformer><transformerimplementation= " Org.apache.maven.plugins.shade.resource.AppendingTransformer "><resource>meta-inf/spring.schemas</ Resource></transformer></transformers></configuration></execution></executions ></plugin>

Right-click the project and run MVN install to package successfully.

The workaround for starting the Times wrong spring error with the standalone executable jar package assembly

Related Article

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.