2013-10-14 80 views
1

我正在開發一個簡單的web應用程序並在tomcat 7上部署。一切工作正常tomcat 7.但是,當我嘗試部署相同的戰爭在tomcat 7在WildFly 8.0.0.Beta1上,我面臨一些錯誤。在WildFly 8.0.0上部署Spring應用程序的錯誤.Beta 1

首先,這是我使用我的應用程序是什麼:

  • 的Maven 3.0.5(與Maven的戰爭插件建築戰爭);
  • Spring 3.2.4.RELEASE;
  • Spring Security 3.1.4.RELEASE;
  • MyFaces 2.1.12;
  • Primefaces 4.0
  • Hibernate 4.2.5.Final(JPA 2);
  • Oracle JDBC 11.2.0.2(Thin Driver);

我也使用commons *,cglib,log4j,slf4j ...如果您還需要這些版本,請告訴我。

我的戰爭的結構:

META-INF 
    - maven 
     - br.com.gsc 
      - projectName 
       pom.xml 
       pom.properties 
    - MANIFEST.MF 
resources 
    - css 
     ...files 
    - images 
     ...files 
     - icons 
      ...files 
    - js 
     ...files 
templates 
    commonHeader.xhtml 
    commonMenu.xhtml 
    template.xhtml 
views 
    - admin 
     ...folders and xhtml files 
    - errors 
     ...folders and xhtml files 
    - login 
     ...folders and xhtml files 
    index.xhtml 
WEB_INF 
    - classes 
     - br (start os the packages) 
      - com 
       - bla 
        - bla2... 
     datasources.properties 
     log4j.properties 
     spring-context-beans.xml 
     spring-context-datasources.xml 
     spring-context-persistences.xml 
     spring-context-security.xml 
    - lib 
    .faces-config.xml.jsfdia 
    faces-config.xml 
    web.xml 

我不明白什麼是錯誤,當我嘗試部署上WildFly應用。我看了Google關於這個錯誤。沒有成功。請看看下面的WildFly日誌:

2013-10-14 14:13:47,231 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.undertow.deployment.default-host./myAppName: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-host./myAppName: Failed to start service 
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1900) [jboss-msc-1.2.0.Beta2.jar:1.2.0.Beta2] 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25] 
    at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25] 
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory. 
    at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:189) 
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:86) 
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:71) 
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1944) [jboss-msc-1.2.0.Beta2.jar:1.2.0.Beta2] 
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1877) [jboss-msc-1.2.0.Beta2.jar:1.2.0.Beta2] 
    ... 3 more 
Caused by: java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory. 
    at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1135) 
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379) 
    at org.apache.myfaces.context.servlet.FacesContextImplBase.getApplication(FacesContextImplBase.java:159) 
    at org.apache.myfaces.context.servlet.FacesContextImplBase.getELContext(FacesContextImplBase.java:210) 
    at javax.faces.component.UIViewRoot.setLocale(UIViewRoot.java:1488) 
    at org.apache.myfaces.webapp.AbstractFacesInitializer._createFacesContext(AbstractFacesInitializer.java:477) 
    at org.apache.myfaces.webapp.AbstractFacesInitializer.initStartupFacesContext(AbstractFacesInitializer.java:449) 
    at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:113) 
    at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173) 
    at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:166) 
    ... 7 more 

2013-10-14 14:13:47,258 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "myAppName.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.undertow.deployment.default-host./myAppName" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-host./myAppName: Failed to start service 
    Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory. 
    Caused by: java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory. "}} 
2013-10-14 14:13:47,323 INFO [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "myAppName.war" (runtime-name : "myAppName.war") 
2013-10-14 14:13:47,324 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report 
JBAS014777: Services which failed to start:  service jboss.undertow.deployment.default-host./myAppName: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-host./myAppName: Failed to start service 

現在,我的web.xml

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns="http://java.sun.com/xml/ns/javaee" 
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
     http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
     version="3.0"> 

    <display-name>AppName</display-name> 

    <context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>classpath:spring-context*.xml</param-value> 
    </context-param> 

    <context-param> 
    <param-name>javax.faces.PROJECT_STAGE</param-name> 
    <param-value>Development</param-value> 
    </context-param> 

    <context-param> 
    <param-name>primefaces.THEME</param-name> 
    <param-value>aristo</param-value> 
    </context-param> 

    <listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 

    <listener> 
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> 
    </listener> 

    <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> 

    <listener> 
    <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class> 
    </listener> 

    <security-constraint> 
    <display-name>Protege os fontes das páginas JSF quando acessadas diretamente</display-name> 
    <web-resource-collection> 
     <web-resource-name>XHTML</web-resource-name> 
     <url-pattern>*.xhtml</url-pattern> 
    </web-resource-collection> 
    <auth-constraint/> 
    </security-constraint> 

    <servlet> 
    <servlet-name>Faces Servlet</servlet-name> 
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> 
    <load-on-startup>1</load-on-startup> 
    </servlet> 

    <filter> 
    <filter-name>PrimeFaces FileUpload Filter</filter-name> 
    <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class> 
    </filter> 

    <filter-mapping> 
    <filter-name>PrimeFaces FileUpload Filter</filter-name> 
    <servlet-name>Faces Servlet</servlet-name> 
    </filter-mapping> 

    <servlet-mapping> 
    <servlet-name>Faces Servlet</servlet-name> 
    <url-pattern>*.jspa</url-pattern> 
    </servlet-mapping> 

    <session-config> 
    <session-timeout>960</session-timeout> 
    </session-config> 

    <error-page> 
    <exception-type>javax.faces.application.ViewExpiredException</exception-type> 
    <location>/views/errors/viewExpired.jspa</location> 
    </error-page> 

    <error-page> 
    <exception-type>java.lang.Exception</exception-type> 
    <location>/views/errors/error.jspa</location> 
    </error-page> 

    <error-page> 
    <error-code>404</error-code> 
    <location>/views/errors/notfound.jspa</location> 
    </error-page> 

    <welcome-file-list> 
    <welcome-file>/views/index.jspa</welcome-file> 
    </welcome-file-list> 
</web-app> 

我沒有使用任何特定的服務器資源的內容。

UPDATE:

這些JAR的是在我的類路徑(WEB-INF/lib目錄):

  • 所有主題-1.0.10.jar
  • ANTLR-2.7.7.jar
  • aopalliance-1.0.jar
  • ASM-4.0.jar
  • aspectjtools-1.5.4.jar
  • b cmail-jdk14-1.38.jar
  • bcprov-jdk14-1.38.jar
  • bctsp-jdk14-1.38.jar
  • bonecp-0.8.0-rc1.jar
  • CGLIB的3.0.jar
  • 公地的BeanUtils-1.8.3.jar
  • 公地編解碼器1.5.jar
  • 公地集合-3.2.jar
  • 公共沼氣池-1.8.jar
  • 公地文件上傳-1.3.jar
  • commons-io-2.4.jar
  • commons-lang-2.5。罐子
  • 共享記錄-1.1.1.jar
  • 的dom4j-1.6.1.jar
  • 番石榴13.0.1.jar
  • 休眠公地的註解,4.0.2.Final.jar
  • 冬眠核-4.2.5.Final.jar
  • 休眠-的EntityManager-4.2.5.Final.jar
  • 冬眠-envers-4.2.5.Final.jar
  • 冬眠-JP-A-2.0- api-1.0.1.Final.jar
  • iText的-4.2.0.jar
  • 了Javassist-3.15.0-GA.jar
  • 的jboss-測井3.1.0.GA.jar
  • jboss-transaction-api_1.1_spec-1.0.1.Final的.jar
  • jcommon-1.0.15.jar
  • jfreechart的-1.0.12.jar
  • JSTL-1.2.jar
  • 的log4j-1.2.17.jar
  • MyFaces的-API-2.1.12 .jar
  • myfaces-impl-2.1.12.jar
  • ojdbc6-11.2.0.2.jar
  • omnifaces-1.5.jar
  • PDF的渲染器-1.0.5.jar
  • POI-3.9.jar
  • primefaces-4.0.jar
  • SLF4J -API-1.7.5.jar
  • SLF4J-簡單1.7.5.jar
  • 彈簧AOP-3.2.4.RELEASE.jar
  • 彈簧豆-3.2.4.RELEASE.jar
  • 彈簧上下文3.2.4.RELEASE.jar
  • 彈簧上下文支撐3.2.4.RELEASE.jar
  • 彈簧芯3.2.4.RELEASE.jar
  • 彈簧expression- 3.2.4.RELEASE.jar
  • 彈簧JDBC-3.2.4.RELEASE.jar
  • 彈簧LDAP的芯 - 1.3.1.RELEASE.jar
  • 彈簧ORM-3.2.4.RELEASE。 jar
  • spring-security-config-3.1.4.RELEASE.jar
  • spring-security-core-3。 1.4.RELEASE.jar
  • 彈簧安全LDAP的3.1.4.RELEASE.jar
  • 彈簧安全網絡3.1.4.RELEASE.jar
  • 彈簧TX-3.2.4.RELEASE。罐子 彈簧網絡3.2.4.RELEASE.jar XML的API-1.0.b2.jar

如果您需要了解我的應用程序更詳細,或約我使用的庫,請讓我知道。

謝謝。

+0

嗯...... Java EE 7上Spring的複雜性? –

+0

嗯,我不能在JEE容器中部署Spring應用程序嗎? –

回答

1

檢查類路徑以查看加載了哪些庫。它接近在classpath上有多個jsf * .jar可用(檢查war/WEB-INF/lib和jboss庫)。

UPDATE:

有在以前的版本中的錯誤WildFly 8.0.0: :https://issues.jboss.org/browse/WFLY-682,它是固定在8.0.0阿爾法4所以它也應該在Beta 1的

FIX工作WildFly與MyFaces等其他實現一起附帶的捆綁JSF實現(Mojarra)存在不兼容性。在web.xml上設置這個參數,你很好走:

<context-param> 
    <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name> 
    <param-value>true</param-value> 
</context-param> 
+0

我用WEB-INF/libs中的所有庫更新了我的問題。我沒有更改JBoss庫,是的,JBoss(WildFly)帶有JSF * libs(mojarra)。但是,我正在使用MyFaces。可能會有一些不兼容? –

+0

請參閱我的更新並嘗試WildFly Beta 4 – ragnor

+0

此錯誤已修復WildFly Alpha 4.目前,主版本爲Beta 1.我認爲此錯誤已在Beta 1中修復。Beta 1版本發佈日期爲2013-10- 04。我會嘗試將WAR_BUNDLES_JSF_IMPL設置爲false以查看會發生什麼。 –

相關問題