wang3048 2017-06-06 03:55 采纳率: 62.5%
浏览 1061

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条回答 默认 最新

  • John_like521 2017-06-06 04:02
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)