2013-12-15 108 views
1

使用hibernate,spring mvc。文件:jboss eap-6.1未能處理部署POST_MODULE的部署「education.war 」

的web.xml

<web-app version="2.4" 
    xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> 

    <display-name>Spring MVC Application</display-name> 
<filter> 
     <filter-name>springSecurityFilterChain</filter-name> 
     <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
    </filter> 
    <filter-mapping> 
     <filter-name>springSecurityFilterChain</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 
    <servlet> 
     <servlet-name>mvc-dispatcher</servlet-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>mvc-dispatcher</servlet-name> 
     <url-pattern>/</url-pattern> 
    </servlet-mapping> 
    <servlet-mapping> 
     <servlet-name>mvc-dispatcher</servlet-name> 
     <url-pattern>/</url-pattern> 
    </servlet-mapping> 

    <servlet-mapping> 
     <servlet-name>mvc-dispatcher</servlet-name> 
     <url-pattern>*.css</url-pattern> 
    </servlet-mapping> 

    <servlet-mapping> 
     <servlet-name>mvc-dispatcher</servlet-name> 
     <url-pattern>*.js</url-pattern> 
    </servlet-mapping> 

    <servlet-mapping> 
     <servlet-name>mvc-dispatcher</servlet-name> 
     <url-pattern>*.gif</url-pattern> 
    </servlet-mapping> 

    <servlet-mapping> 
     <servlet-name>mvc-dispatcher</servlet-name> 
     <url-pattern>*.jpg</url-pattern> 
    </servlet-mapping> 

    <servlet-mapping> 
     <servlet-name>mvc-dispatcher</servlet-name> 
     <url-pattern>*.png</url-pattern> 
    </servlet-mapping> 
</web-app> 

主要背景文件

<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:mvc="http://www.springframework.org/schema/mvc" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd" 

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

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
     <property name="prefix" value="/WEB-INF/pages/"/> 
     <property name="suffix" value=".jsp"/> 
    </bean> 
    <mvc:annotation-driven /> 
    <mvc:resources mapping="/resources/**" location="/resources/" /> 
    <import resource="root-context.xml" /> 
</beans> 

根的context.xml

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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:lang="http://www.springframework.org/schema/lang" 
     xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" 
     xmlns:util="http://www.springframework.org/schema/util" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd 
     http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd 
     http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd 
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd 
     http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> 


    <context:annotation-config /> 


    <context:component-scan base-package="com.education.Dao" /> 
    <context:component-scan base-package="com.education.Service" /> 

    <import resource="data.xml" /> 


    <import resource="security.xml" /> 

</beans> 

之前,我successuly編譯並運行該應用程序,然後添加休眠代碼和這個XML文件並遇到錯誤。

錯誤代碼

16:40:50,403 ERROR [org.jboss.as.server] (management-handler-thread - 12) JBAS015870: Deploy of deployment "education.war" was rolled back with the following failure message: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"education.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"education.war\".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment \"education.war\" Caused by: java.lang.LinkageError: Failed to link org/springframework/web/filter/GenericFilterBean (Module \"deployment.education.war:main\" from Service Module Loader) Caused by: java.lang.NoClassDefFoundError: org/springframework/context/EnvironmentAware Caused by: java.lang.ClassNotFoundException: org.springframework.context.EnvironmentAware from [Module \"deployment.education.war:main\" from Service Module Loader]"}} 16:40:50,533 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015877: Stopped deployment education.war (runtime-name: education.war) in 130ms

+0

您使用的是什麼版本的Spring? –

+0

3.2.0發佈版本 –

回答

1

這條線的堆棧跟蹤了一切:

Caused by: java.lang.NoClassDefFoundError: org/springframework/context/EnvironmentAware Caused by: java.lang.ClassNotFoundException: org.springframework.context.EnvironmentAware

你需要的,如果使用Maven添加spring-context到您的pom.xml文件:

<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-context</artifactId> 
    <version>3.1.3.RELEASE</version> 
</dependency> 

注意版本可能因您的項目而異

0

我同意凱文,在你的情況下,類文件丟失。所以你將不得不放置包含這些類文件的JAR。但是我在Linux服務器上遇到了這個問題。該問題與文件權限問題有關。在這種情況下,很難找出問題,因爲錯誤消息或日誌沒有明確指出問題。通常情況下,Linux在權限問題上很好。我以root用戶的身份創建WAR文件,但以jboss用戶的身份運行jboss服務器。最後,我不得不「使用sudo -su jboss」(運行Jboss服務器的用戶)並創建/部署我的工件。