加载FacesContextFactory时出错

时间:2014-05-08 17:18:16

标签: jsf migration

我正在将我的应用程序从jsf 1.2迁移到2.0,并且我已按照此网址进行迁移http://www.ibm.com/developerworks/rational/library/java-server-faces-migration/    但是当在weblogic服务器中部署时,我面临以下问题

[HTTP:101216] Servlet:“Faces Servlet”无法在Web应用程序启动时预加载:“customer-web”。 java.lang.IllegalStateException:应用程序在启动时未正确初始化,无法在javax.faces.FactoryFinder的javax.faces.FactoryFinder $ FactoryManager.getFactory(FactoryFinder.java:804)找到Factory:javax.faces.context.FacesContextFactory。 getFactory(FactoryFinder.java:306)位于weblogic.security.acl上的weblogic.servlet.internal.StubSecurityHelper $ ServletInitAction.run(StubSecurityHelper.java:283)的javax.faces.webapp.FacesServlet.init(FacesServlet.java:166) .internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)位于weblogic上的weblogic.seternal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)的weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)。 servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)位于weblogic的weblogic.servlet.internal.StubLifecycleHelper。(StubLifecycleHelper.java:48),位于weblogic的weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:531)。 servlet.intern位于weblogic.servlet上的weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1807)的weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1889)中的al.WebAppServletContext.preloadServlet(WebAppServletContext.java:1915) .internal.WebAppServletContext.start(WebAppServletContext.java:3045)位于weblogic上的weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:460)的weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1397)。 weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java)中的weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83)中的application.internal.flow.ModuleStateDriver $ 3.next(ModuleStateDriver.java:425) :119)at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)at weblogic.application.inter nal.flow.ModuleStateDriver $ 3.next(ModuleStateDriver.java:425)at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:83)at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119 )at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)at weblogic.application.internal.BaseDeployment $ 2.next(BaseDeployment.java:1267)at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver) .java:83)at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:54)at weblogic.application.internal.DeploymentStateChecker.activate( DeploymentStateChecker.java:161)at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)at weblogic.deploy .internal.targetserv er.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(在weblogic.deploy.inploy.internal上的weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)的weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)中的AbstractOperation.java:323) .targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java) :181)at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access $ 100(DeploymentReceiverCallbackDeli verer.java:12)at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer $ 2.run(DeploymentReceiverCallbackDeliverer.java:67)at weblogic.work.SelfTuningWorkManagerImpl $ WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)at weblogic.work。 weblogic.work.ExecuteThread.run上的ExecuteThread.execute(ExecuteThread.java:201)(ExecuteThread.java:173)

我的web.xml是

    <?xml version="1.0" encoding="ISO-8859-1"?>
<web-app 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_5.xsd"
    version="2.5">

    <display-name>Customer Web</display-name>

    <!-- The master configuration file for this Spring web application -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/config/web-application-config.xml
        </param-value>
    </context-param>

    <!-- Faces configuration -->
    <context-param>
        <param-name>javax.faces.application.CONFIG_FILES</param-name>
            <param-value>
                /WEB-INF/faces-config.xml,
                /WEB-INF/project-faces-config.xml
        </param-value>
    </context-param>    
    <!-- Tag libs for facelets -->
    <context-param>
       <param-name>facelets.LIBRARIES</param-name>
       <param-value>
           /WEB-INF/facelets.taglib.xml
       </param-value>
    </context-param>

    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>

    <!-- Enables special Facelets debug output during development -->
    <context-param>
        <param-name>facelets.DEVELOPMENT</param-name>
        <param-value>true</param-value>
    </context-param>

    <!-- Causes Facelets to refresh templates during development -->
    <context-param>
        <param-name>facelets.REFRESH_PERIOD</param-name>
        <param-value>1</param-value>
    </context-param>

    <!-- Enforce UTF-8 Character Encoding -->
    <filter>
        <filter-name>charEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>charEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- Enables Spring Security -->
     <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>

    <!-- Loads the Spring web application context -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- <listener>   
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>   
</listener> --> 



    <!-- For spring-managed request- and session-scoped beans -->
    <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>
    <!-- Serves static resource content from .jar files such as spring-faces.jar -->
    <servlet>
        <servlet-name>Resources Servlet</servlet-name>
        <servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
        <load-on-startup>0</load-on-startup>
    </servlet>

    <!-- Map all /resources requests to the Resource Servlet for handling -->
    <servlet-mapping>
        <servlet-name>Resources Servlet</servlet-name>
        <url-pattern>/resources/*</url-pattern>
    </servlet-mapping>

    <!-- The front controller of this Spring Web application, responsible for handling all application requests -->
    <servlet>
        <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value></param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <!-- Map all /pages requests to the Dispatcher Servlet for handling -->
    <servlet-mapping>
        <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
        <url-pattern>/pages/*</url-pattern>
    </servlet-mapping>

    <!-- Just here so the JSF implementation can initialize, *not* used at runtime -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <!-- Just here so the JSF implementation can initialize -->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
    </servlet-mapping>   

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>     
    </welcome-file-list>

    <error-page>
        <exception-type>java.lang.Exception</exception-type>
        <location>/pages/error</location>
    </error-page>

    <error-page>
       <error-code>403</error-code>
       <location>/pages/accessDenied</location>
    </error-page>

    <error-page>
       <error-code>500</error-code>
       <location>/pages/error</location>
    </error-page>

</web-app>

1 个答案:

答案 0 :(得分:2)

请检查jsf-api-2.x.y.jar(以及其他JSF 2.0依赖项)是否在CLASSPATH中。