诡异的Unable to locate Spring NamespaceHandler for XML schema namespace

博主那苦逼的寻找真理的过程就不说了,这里说一下问题和最终解决办法,在此记录一下


博主在开发批量程序后,通过maven打包,打包配置如下:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.xxx.schedule.xxx.JobMain</mainClass>
<useUniqueVersions>false</useUniqueVersions>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

通过 运行java -jar xxxx.jar 抛出
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingExcept
ion: Configuration problem: Unable to locate Spring NamespaceHandler for XML sch
ema namespace [http://www.springframework.org/schema/context]

经过了一段漫长又苦逼的过程后,博主发现在jar包的META-INF目录下有个INDEX.LIST 文件
里面包含了所有jar文件内容的访问路径,内容如下
lib/spring-batch-core-2.2.7.RELEASE.jar
META-INF
META-INF/maven
META-INF/maven/org.springframework.batch
META-INF/maven/org.springframework.batch/spring-batch-core
org
org/springframework
org/springframework/batch
org/springframework/batch/core
org/springframework/batch/core/annotation
org/springframework/batch/core/configuration
org/springframework/batch/core/configuration/annotation
org/springframework/batch/core/configuration/support
org/springframework/batch/core/configuration/xml
org/springframework/batch/core/converter
org/springframework/batch/core/explore
org/springframework/batch/core/explore/support
org/springframework/batch/core/job
org/springframework/batch/core/job/builder
org/springframework/batch/core/job/flow
org/springframework/batch/core/job/flow/support
org/springframework/batch/core/job/flow/support/state
org/springframework/batch/core/launch
org/springframework/batch/core/launch/support
org/springframework/batch/core/listener
org/springframework/batch/core/migration
org/springframework/batch/core/partition
org/springframework/batch/core/partition/support
org/springframework/batch/core/repository
org/springframework/batch/core/repository/dao
org/springframework/batch/core/repository/support
org/springframework/batch/core/resource
org/springframework/batch/core/scope
org/springframework/batch/core/scope/context
org/springframework/batch/core/step
org/springframework/batch/core/step/builder
org/springframework/batch/core/step/factory
org/springframework/batch/core/step/item
org/springframework/batch/core/step/job
org/springframework/batch/core/step/skip
org/springframework/batch/core/step/tasklet

lib/spring-batch-infrastructure-2.2.7.RELEASE.jar
META-INF/maven
META-INF/maven/org.springframework.batch
META-INF/maven/org.springframework.batch/spring-batch-infrastructure
org
org/springframework
org/springframework/batch
org/springframework/batch/item
org/springframework/batch/item/adapter
org/springframework/batch/item/amqp
org/springframework/batch/item/data
org/springframework/batch/item/database
org/springframework/batch/item/database/orm
org/springframework/batch/item/database/support
org/springframework/batch/item/file
org/springframework/batch/item/file/mapping
org/springframework/batch/item/file/separator
org/springframework/batch/item/file/transform
org/springframework/batch/item/jms
org/springframework/batch/item/mail
org/springframework/batch/item/mail/javamail
org/springframework/batch/item/support
org/springframework/batch/item/util
org/springframework/batch/item/validator

在看完[url]http://www.ibm.com/developerworks/cn/java/j-jar/[/url],怀疑是由于这个文件导致加载lib失败,果断删除,至此一切回复如初。
此处有两个疑问还没明白,待有时间再细看:
1.此文件打包时时如何生成的?
2.此文件是否对jvm classload 有影响?
如果某位大神不小心看到了,麻烦也给小弟讲解一下,感激不尽!!!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值