2014-04-07 1 views
0

Eclipse/Spring/Maven 프로젝트에서 작업 중입니다. 내 pom.xml 파일은 다음과 같습니다Maven 어셈블리 플러그인으로 생성 된 JAR 실행시 오류

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.javacodegeeks.snippets.enterprise</groupId> 
    <artifactId>springexample</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <build> 
    <plugins> 
    <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-assembly-plugin</artifactId> 
       <version>2.2.1</version> 
       <executions> 
        <execution> 
         <id>package-jar-with-dependencies</id> 
         <phase>package</phase> 
         <goals> 
          <goal>single</goal> 
         </goals> 
         <configuration> 
          <appendAssemblyId>false</appendAssemblyId> 
          <descriptorRefs> 
           <descriptorRef>jar-with-dependencies</descriptorRef> 
          </descriptorRefs> 
          <archive> 
           <manifest> 
            <mainClass>com.javacodegeeks.snippets.enterprise.App2</mainClass> 
           </manifest> 
          </archive> 
          <resources> 
            <resource> 
           <directory>src/main/resources</directory> 
           <filtering>true</filtering> 
            </resource> 
          </resources> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
</plugins> 


       </build>   
      <dependencies> 
       <dependency> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-core</artifactId> 
       <version> 3.2.4.RELEASE</version> 
       </dependency> 
       <dependency> 
        <groupId>com.rapplogic</groupId> 
        <artifactId>xbee-api</artifactId> 
        <version> 0.9</version> 
       </dependency> 
       <dependency> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-context</artifactId> 
        <version>3.2.4.RELEASE</version> 
       </dependency> 

       <dependency> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-orm</artifactId> 
        <version>3.2.4.RELEASE</version> 
       </dependency> 
       <dependency> 
        <groupId>commons-dbcp</groupId> 
      <artifactId>commons-dbcp</artifactId> 
      <version>1.2.2</version> 
     </dependency> 
     <dependency> 
      <groupId>javax.persistence</groupId> 
      <artifactId>persistence-api</artifactId> 
      <version>1.0</version> 
     </dependency> 
     <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
      <version>5.1.6</version> 
     </dependency> 
     <dependency> 
      <groupId>jfreechart</groupId> 
      <artifactId>jfreechart</artifactId> 
      <version>1.0.0</version> 
     </dependency> 
     <dependency> 
      <groupId>jcommon</groupId> 
      <artifactId>jcommon</artifactId> 
      <version>0.9.5</version> 
     </dependency> 
     <dependency> 
      <groupId>org.graphstream</groupId> 
      <artifactId>gs-core</artifactId> 
      <version>1.2</version> 
     </dependency> 
     <dependency> 
      <groupId>org.graphstream</groupId> 
      <artifactId>gs-ui</artifactId> 
      <version>1.2</version> 
     </dependency> 
     <dependency> 
      <groupId>org.graphstream</groupId> 
      <artifactId>gs-algo</artifactId> 
      <version>1.2</version> 
     </dependency> 
     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.17</version> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-core</artifactId> 
      <version>4.1.9.Final</version> 
     </dependency>   
     <dependency> 
      <groupId>org.rxtx</groupId> 
      <artifactId>rxtx</artifactId> 
      <version>2.1.7</version> 
     </dependency> 
     <dependency> 
      <groupId>org.bidib.jbidib.org.qbang.rxtx</groupId> 
      <artifactId>rxtxcomm</artifactId> 
      <version>2.2</version> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework</groupId> 
     <artifactId>spring-tx</artifactId> 
     <version>4.0.0.RELEASE</version> 
     </dependency> 
    </dependencies> 
</project> 

내 applicationContext.xml은 다음과 같습니다

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

내가 mvn install 다음 mvn package을한다. 프로젝트의 대상 디렉토리에 springexample-0.0.1-SNAPSHOT.jar이라는 출력이 표시됩니다. 그런 다음 명령 java - jar springexample-0.0.1-SNAPSHOT.jar을 입력하고 다음과 같은 오류 얻을 : 인터넷을 통해 유사한 문제를 통해

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Config 
uration problem: Unable to locate Spring NamespaceHandler for XML schema namespa 
ce [http://www.springframework.org/schema/tx] 
Offending resource: class path resource [applicationContext.xml] 

Browsinf를, 나는 오류의 두 가지 소스를 발견

  1. 비 지정 네임 스페이스 처리를 위해 스프링 라이브러리를 (spring-tx) - done (의존성에 포함) 2. maven 어셈블리 플러그인의 리소스에 applicationContext.xml을 지정하지 않았습니다. - done (리소스 태그가 플러그인 구성에 포함되어 있습니다).

그 후, 나는 무엇이 문제 일 수 있는지 모른다. 도움이 감사, 감사합니다.

+0

합니까? @MichalB –

답변

0

시도 대신 4.0.0.RELEASE의이 추가 : 다음

<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-tx</artifactId> 
    <version> 3.2.4.RELEASE</version> 
</dependency> 

와 내가 .. 당신이이 문제를 해결 할 수 같은 문제에 직면 오전 mvn clean install

+0

그랬지만 같은 오류가 나타납니다 ... – MichalB