humungs
humungs

Reputation: 1184

Deploy error of spring application on WildFly 8.0.0.Beta 1

I am developing a simple web application and deploying on tomcat 7. Everything works fine on tomcat 7. However, when I try to deploy the same war that works on tomcat 7 on WildFly 8.0.0.Beta1, I am facing some errors.

First of all, this is what I am using on my application:

I'm also using commons*, cglib, log4j, slf4j... if you need these versions too, let me know.

The structure of my WAR:

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

I didn't understand what is the error when I try to deploy the application on WildFly. I looked at Google about this error. No success. Please, take a look at the WildFly log below:

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

Now, the content of my 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>

I am not using any specific server resource.

UPDATE:

These JAR's are in my classpath (WEB-INF/lib):

If you need more detail about my application, or about the libs that I am using, please let me know.

Thanks.

Upvotes: 1

Views: 4659

Answers (1)

ragnor
ragnor

Reputation: 2528

Check classpath to see what libraries are loaded. It seams that more than one jsf*.jar is available on classpath (check war/WEB-INF/lib and jboss libs).

UPDATE:

There was a bug in previous version WildFly 8.0.0: https://issues.jboss.org/browse/WFLY-682, it is fixed in 8.0.0 Alpha 4 so it should also work on Beta 1

FIX: There is an incompatibility about the bundled JSF implementation (Mojarra) that come with WildFly with other implementations like MyFaces. Set this parameter on web.xml and your are good to go:

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

Upvotes: 1

Related Questions