The problem is that when it comes to spring, the local IDE runs normally, but runs the times wrong on the cluster after packaging.
The source of the problem is determined by the multi-party lookup of the data, and the file overwrite occurs because many packages of spring are called in the dependency.
Specifically,
These three files. After viewing, only the TX configuration is left.
Workaround
The first approach is to use MAVEN's packaged plug-in to keep the configuration information for each spring package:
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactid>maven-shade-plugin</artifactid>
- <version> 1.7.1</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>
- <transformer
- implementation="Org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
- <mainClass>com.chenzhou.test.main</mainClass>
- </transformer>
- </Transformers>
- </configuration>
- </Execution>
- </Executions>
- </plugin>
But this approach limits the ability to package only with this Maven plugin, in fact, as long as the three files contain the full configuration information.
The second method is actually very simple, to find these three files, with the three full files I provide can be overwritten.
Typically, these three files are under the meta-inf path under the jar package
Download link for Http://files.cnblogs.com/files/starwater/spring.zip
Configuration problem:unable to locate Spring Namespacehandler for XML schema namespace workaround