2 개의 모듈을 가진 프로젝트가 있습니다. 1) Midtier & 2) webapp.Tomcat 컨텍스트 초기화에 실패했습니다.
내 중간 계층에는 Bean을로드하기 위해 지정된 패키지에 대한 구성 요소 스캔을 수행하는 Bean 구성 파일이 있습니다. 내가 작성한 클래스 중 하나는 ApplicationContextUtils로, ApplicationContextAware 인터페이스가 확장되어 있습니다.이 인터페이스는 jar SPRING-CONTEXT에 있습니다. (예, ApplicationContextUtils 클래스에 주석 @Component를 태그했습니다.) 이 프로젝트의 pom은 spring-context-3.2.4.RELEASE를 종속 항아리로 선언했습니다 & 나는 Maven 의존성에서 그것을 볼 수 있습니다. 나는 모든 콩을로드하는 테스트를 실행하여이 클래스를 단독으로 테스트했습니다. & 잘 실행되었습니다.
이제 webapp로 이동하면 webapp의 pom이 해당 midtier를 종속성으로 설명합니다. 이 mid-tier 프로젝트가 webapp에 종속 의존성으로 나열된 것을 볼 수 있습니다. 내가 오류 다음 톰캣에 일식에서이 프로젝트를 가지고 배포 : 내가 얻을 수
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [com.jms.testjms.ApplicationContextUtils] for bean with name 'applicationContextUtils' defined in file [F:\Projects\ActiveMQ\JMSProject\target\classes\com\jms\testjms\ApplicationContextUtils.class]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware
.
.
.
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware
(& lot of error chains ..)
유일한 이유는 단지 스프링 컨텍스트는 클래스 경로에 있지이다. 하지만, WEB-INF/lib에서 체크인했을 때 물론 ApplicationContextAware 인터페이스의 소스 인 jar spring-context-3.2.4.RELEASE가 있습니다. 스프링이이 인터페이스를 찾을 수없는 이유를 모르겠습니다.
스프링 3.2.4를 사용하고 있습니다. 내 web.xml은 ContextLoaderListener를 사용하여 시작하는 동안 리소스를로드합니다. 이 프로젝트는 maven을 사용하여 빌드됩니다.
어떤 통찰력이라도 대단히 감사하겠습니다. 중간 계층에서
POM : 웹 애플리케이션에서
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jms.test</groupId>
<artifactId>JmsTest</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>Spring Utility</name>
<url>http://www.springframework.org</url>
<description>
<![CDATA[
This project is a minimal jar utility with Spring configuration.
]]>
</description>
<properties>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
<spring.framework.version>3.2.4.RELEASE</spring.framework.version>
</properties> <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.framework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-spring</artifactId>
<version>5.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-pool</artifactId>
<version>5.8.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
치어 :
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>JmsProtoWebApp</groupId>
<artifactId>JMSWebApp</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>JMSWebApp Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
<spring.framework.version>3.2.4.RELEASE</spring.framework.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.framework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>servlet-api</artifactId>
<version>6.0.37</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jms.test</groupId>
<artifactId>JmsTest</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>
<finalName>JMSWebApp</finalName>
</build>
</project>
프로젝트 구조 & 배포 어셈블리 :이 http://imgur.com/zydcqSm
이클립스에서 프로젝트 구조의 'pom'과 이미지를 게시하십시오. –
중간 계층 및 webapp에서 pom으로 게시물을 업데이트했습니다. 포함 된 프로젝트 구조 및 배포 어셈블리에 대한 링크입니다 –
당신은 또한 바람둥이 봄 용기를 배포해야합니다. – happymeal