【问题标题】:Why am I getting WebXml is not initialized yet?为什么我得到 WebXml 尚未初始化?
【发布时间】:2014-01-13 22:41:25
【问题描述】:

我有一个带有 JSF2、Primefaces、Spring 和 Hibernate 的 Maven Web 应用程序。 所以我最近将我的 Web 应用程序从 Glassfish 3 迁移到了 Weblogic 12c。 当它在 Glassfish 上运行时,它运行良好,但在方面库出现一些问题后迁移我的应用程序后,我设法部署了它。但是在运行我的应用程序后,我发现了一个错误。当我的 xhtml 运行并从我的托管 bean 构造函数加载数据时,它会获取数据并按预期呈现它,但是如果我触发 ajax 事件,它会获取预期的数据但它不会呈现数据并且我得到下一个异常:

<11/01/2014 07:56:27 PM CST> <Error> <javax.enterprise.resource.webcontainer.jsf.application> <BEA-000000> <Error Rendering View[/pages/dashboard.xhtml]
java.lang.IllegalStateException: WebXml is not initialized yet. Please use #init(ServletContext) method to manually initialize it.
    at org.omnifaces.config.WebXml.checkInitialized(WebXml.java:313)
    at org.omnifaces.config.WebXml.getFormLoginPage(WebXml.java:294)
    at org.omnifaces.context.OmniPartialViewContext$OmniPartialResponseWriter.startDocument(OmniPartialViewContext.java:253)
    at org.primefaces.context.PrimePartialResponseWriter.startDocument(PrimePartialResponseWriter.java:134)
    at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:287)
    Truncated. see log file for complete stacktrace
> 
<11/01/2014 07:56:27 PM CST> <Error> <HTTP> <BEA-101020> <[ServletContext@11936366[app:geotrack1-1.0-SNAPSHOT module:geotrack1-1.0-SNAPSHOT.war path:null spec-version:3.0]] Servlet failed with an Exception
java.lang.IllegalStateException: WebXml is not initialized yet. Please use #init(ServletContext) method to manually initialize it.
    at org.omnifaces.config.WebXml.checkInitialized(WebXml.java:313)
    at org.omnifaces.config.WebXml.getFormLoginPage(WebXml.java:294)
    at org.omnifaces.context.OmniPartialViewContext$OmniPartialResponseWriter.startDocument(OmniPartialViewContext.java:253)
    at org.primefaces.context.PrimePartialResponseWriter.startDocument(PrimePartialResponseWriter.java:134)
    at com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError(AjaxExceptionHandlerImpl.java:201)
    Truncated. see log file for complete stacktrace
> 
<11/01/2014 07:56:27 PM CST> <Notice> <Diagnostics> <BEA-320068> <Watch "UncheckedException" in module "Module-FMWDFW" with severity "Notice" on server "AdminServer" has triggered at 11/01/2014 07:56:27 PM CST. Notification details: 
WatchRuleType: Log 
WatchRule: (SEVERITY = 'Error') AND ((MSGID = 'WL-101020') OR (MSGID = 'WL-101017') OR (MSGID = 'WL-000802') OR (MSGID = 'BEA-101020') OR (MSGID = 'BEA-101017') OR (MSGID = 'BEA-000802')) 
WatchData: DATE = 11/01/2014 07:56:27 PM CST SERVER = AdminServer MESSAGE = [ServletContext@11936366[app:geotrack1-1.0-SNAPSHOT module:geotrack1-1.0-SNAPSHOT.war path:null spec-version:3.0]] Servlet failed with an Exception

有谁知道发生了什么? 这是我的 web.xml

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

    <!-- Spring Context Configuration' s Path definition -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/classes/applicationContext.xml
        </param-value>
    </context-param>
    <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>         
    <!-- The Bootstrap listener to start up and shut down Spring's root WebApplicationContext. It is registered to Servlet Container -->
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
    <listener>
        <listener-class>
            org.springframework.web.context.request.RequestContextListener
        </listener-class>
    </listener>


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

    <!-- JSF Servlet is defined to container -->

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

    <!-- Mapping with servlet and url for the http requests. -->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>

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

    <!-- Configuracion de Quartz -->
    <listener>
        <listener-class>org.quartz.ee.servlet.QuartzInitializerListener</listener-class>
    </listener>   

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

    <session-config>
        <session-timeout>
            15
        </session-timeout>
    </session-config>
</web-app>

在我的 weblogic.xml 中,我已经:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
    <container-descriptor>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
    <jsp-descriptor>
        <keepgenerated>true</keepgenerated>
        <debug>true</debug>
    </jsp-descriptor>
    <context-root>/geotrack1</context-root>
</weblogic-web-app>

我希望有人知道发生了什么。 提前致谢。

【问题讨论】:

    标签: jsf-2 weblogic omnifaces


    【解决方案1】:

    它已在 2013 年 10 月 29 日报告为 issue 273,并已修复为 1.7,刚刚发布:

    <dependency>
        <groupId>org.omnifaces</groupId>
        <artifactId>omnifaces</artifactId>
        <version>1.7</version>
    </dependency>
    

    【讨论】:

    • 我先尝试了 1.7 版本,但存储库没有找到它。
    • Maven Central 今天似乎很忙。给它一些时间来同步。如果你等不及,你可以随时抓住1.7-SNAPSHOT。如有麻烦,抱歉。
    【解决方案2】:

    为了解决这个问题,我将 pom 从 omnifaces 1.6.3 更改为 ominifaces 1.5

    【讨论】:

      猜你喜欢
      • 2016-08-04
      • 2019-05-22
      • 2019-01-10
      • 1970-01-01
      • 1970-01-01
      • 2012-02-13
      • 2016-07-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多