首页 新闻 会员 周边 捐助

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

0
悬赏园豆:5 [待解决问题]

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配置如下:

<beans xmlns="http://www.springframework.org/schema/beans"
    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>

</beans>

 

pom.xml配置如下:

<dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>4.1.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>4.1.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.1.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>4.1.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>4.1.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.ws</groupId>
            <artifactId>spring-ws-core</artifactId>
            <version>2.4.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>sqljdbc4</artifactId>
            <version>4.0</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>c3p0</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.1.2</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.1</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.1</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>            
            <plugin>  
              <artifactId>maven-assembly-plugin</artifactId>  
              <configuration>  
                  <archive>  
                      <manifest>  
                          <mainClass>com.jytime.remind.App</mainClass>  
                      </manifest>  
                  </archive>  
                  <descriptorRefs>  
                      <descriptorRef>  
                          jar-with-dependencies  
                      </descriptorRef>  
                  </descriptorRefs>  
              </configuration>  
              <executions>  
                    <execution>  
                        <phase>package</phase>  
                        <goals>  
                            <goal>single</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>  
                            </transformers>  
                        </configuration>  
                    </execution>  
                </executions>   
          </plugin>
        </plugins>
    </build>

 

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

00随风00的主页 00随风00 | 初学一级 | 园豆:197
提问于:2017-06-06 11:45
< >
分享
所有回答(1)
0

需添加spring-security.config.jar文件

ycyzharry | 园豆:25683 (高人七级) | 2017-06-07 13:45

不明白,打包和这个jar包有啥关系吗?

支持(0) 反对(0) 00随风00 | 园豆:197 (初学一级) | 2017-06-14 12:02
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册