maven项目生成的jar包运行java -jar 包名报错 Configuration problem: Unable to locate Spring NamespaceHandler for X

2021-02-14 16:16

阅读:643

标签:form   osc   htm   als   nap   plugin   mamicode   clip   transform   

1.我的maven项目在eclipse中Run As->Maven install,生成jar包后,用java -jar 包名 运行报错。报错图如下:

技术图片

2.百度查了很多,有说版本号不一致的,有说缺少jar包的,有说用maven-shade-plugin插件的。

3.下面粘贴一下我的pom.xml和applicationContext.xml的代码

4.0.0com.oscar.bdc.rpc
  rpcthriftserver
  0.0.1-SNAPSHOTjarrpcthriftserverhttp://maven.apache.orgUTF-84.1.9.RELEASEjunit
      junit
      3.8.1testorg.apache.thrift
            libthrift
            0.11.0commons-io
	        commons-io
	        2.6org.springframework
			spring-core
			${spring.version}commons-logging
					commons-logging
				org.springframework
			spring-beans
			${spring.version}org.springframework
			spring-context
			${spring.version}org.springframework
			spring-context-support
			${spring.version}org.springframework
			spring-aop
			${spring.version}commons-logging
					commons-logging
				org.springframework
			spring-tx
			${spring.version}org.springframework
			spring-orm
			${spring.version}org.springframework
			spring-jdbc
			${spring.version}org.apache.maven.plugins
                maven-compiler-plugin
                2.3.21.81.8${endorsed.dir}
		      maven-assembly-plugin
		      
		         	 true
					 lib/com.oscar.bdc.rpc.RPCThriftServerApplicationjar-with-dependenciesmake-assemblypackagesingle

   

Spring Configuration

 4.先把pom.xml缺少的jar包在applicationContext.xml中删掉引用,这个方案不可以。

   5. 然后maven-shade-plugin这个插件,之前加了这个插件到pom.xml中不可以。

   6.特别注意:是把maven-shade-plugin插件替换了maven-assembly-plugin插件。注意是替换。替换了就可以用了。运行没问题。下面粘贴替换后的pom.xml

 

4.0.0com.oscar.bdc.rpc
  rpcthriftserver
  0.0.1-SNAPSHOTjarrpcthriftserverhttp://maven.apache.orgUTF-84.1.9.RELEASEjunit
      junit
      3.8.1testorg.apache.thrift
            libthrift
            0.11.0commons-io
	        commons-io
	        2.6org.springframework
			spring-core
			${spring.version}commons-logging
					commons-logging
				org.springframework
			spring-beans
			${spring.version}org.springframework
			spring-context
			${spring.version}org.springframework
			spring-context-support
			${spring.version}org.springframework
			spring-aop
			${spring.version}commons-logging
					commons-logging
				org.springframework
			spring-tx
			${spring.version}org.springframework
			spring-orm
			${spring.version}org.springframework
			spring-jdbc
			${spring.version}org.apache.maven.plugins
                maven-compiler-plugin
                2.3.21.81.8${endorsed.dir}org.apache.maven.plugins
				maven-shade-plugin
				3.1.1packageshadeMETA-INF/spring.handlersMETA-INF/spring.schemascom.oscar.bdc.rpc.RPCThriftServerApplication

  

maven项目生成的jar包运行java -jar 包名报错 Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]

标签:form   osc   htm   als   nap   plugin   mamicode   clip   transform   

原文地址:https://www.cnblogs.com/fzdsy/p/12722613.html

上一篇:归并排序

下一篇:一 Laya3D Unity插件安装


评论


亲,登录后才可以留言!