maven插件打包jar,在myeclipse运行没有错误,运行jar时报错

Excepion in thread "main" org.springframework.beans.factory.
parsing.BeanDefinitionPersingException:
Configuration problem:Unable to locate Spring NamespaceHandler for XML
schema namespace [http://www.springframework.org/schema/context] Offending resource:
class path resource [applicationContext.xml]

applicationContext.xml配置如下:

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd">

<context:component-scan base-package="com.jytime"></context:component-scan>

<!-- 数据库连接池 非单例属性 scope="prototype" -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
    destroy-method="close">
    <property name="driverClass" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
    <property name="jdbcUrl" value="jdbc:sqlserver://192.168.2.101;DatabaseName=pm" />
    <property name="user" value="sa" />
    <property name="password" value="123" />
</bean>

<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    <property name="dataSource" ref="dataSource"></property>
</bean>

<task:scheduler id="taskScheduler" pool-size="100"></task:scheduler>

<task:scheduled-tasks scheduler="taskScheduler">
    <task:scheduled ref="taskRemind" method="execute1" cron="0 0 10 * * ?" />
</task:scheduled-tasks>

pom.xml配置如下:
复制代码



org.springframework
spring-core
4.1.7.RELEASE


org.springframework
spring-beans
4.1.7.RELEASE


org.springframework
spring-context
4.1.7.RELEASE


org.springframework
spring-test
4.1.7.RELEASE


org.springframework
spring-jdbc
4.1.7.RELEASE


org.springframework.ws
spring-ws-core
2.4.0.RELEASE


com.microsoft.sqlserver
sqljdbc4
4.0
jar
compile


c3p0
c3p0
0.9.1.2
jar
compile


junit
junit
4.11
test


org.slf4j
slf4j-api
1.6.1
jar
compile


log4j
log4j
1.2.16
compile


org.slf4j
slf4j-log4j12
1.6.1
jar
compile







maven-assembly-plugin







com.jytime.remind.App









jar-with-dependencies











package



single







implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">

META-INF/spring.handlers



implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">

META-INF/spring.schemas













复制代码

请高人帮忙解答一下,实在不知道怎么回事

1个回答

你在myeclise中用maven打包可以成功访问项目么

scgyus
John_like521 回复wang3048:你是把项目打成jar包调用里面的接口
2 年多之前 回复
wang3048
wang3048 回复john大叔: 就是一个java项目,java -jar启动,不是web项目
2 年多之前 回复
scgyus
John_like521 回复wang3048: 你是打成jar包放到什么环境访问?
2 年多之前 回复
wang3048
wang3048 在myeclipse中运行没有错,maven build打包成jar,运行就出这个错误了
2 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问