JSF中带有Ajax请求的error @ malformedXML [英] error@malformedXML with ajax requests in JSF

查看:166
本文介绍了JSF中带有Ajax请求的error @ malformedXML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上下文:Weblogic 12.2.1/JSF 2.1.6/Richfaces 4.2.2/Primefaces 3.4

我有一个WebLogic 10.3.6上的JSF应用程序,并且已成功在Weblogic 12.2.1上进行了部署.

I have a JSF application that was on Weblogic 10.3.6 and that I successfully deploy on Weblogic 12.2.1.

每个ajax请求后我都遇到以下错误:

I am facing the following error after each ajax request :

Received 'error@malformedXML' event from <input ...
[200] undefined: undefined

当页面中不存在要渲染的组件时,通常会发生此错误,但是正如您将在以下代码段中看到的那样,情况并非如此:

This error usually occurres when the component to be rendered is not present in the page but as you'll see in the following pieces of code, this is not the case :

private int count = 0;

public void commandButton() {
    System.out.println("Click");
    count++;
}

public int getCount() {
    return count;
}

public void setCount(int count) {
    this.count = count;
}

HTML


带有Ajax的JSF

HTML


JSF with Ajax

<h:form>
    <h:commandButton value="JSF with ajax">
        <f:ajax listener="#{myBean.commandButton}" render="count1" />
    </h:commandButton>
    <h:outputText id="count1" value="#{myBean.count}" />
</h:form>

单击此按钮可以正确执行myBean.commandButton,但随后会产生以下所述的错误并刷新页面.

The click on this button correctly executes myBean.commandButton but then produces the error described below and does a "refresh" of the page.

<h:form>
    <a4j:commandButton value="Richfaces" action="#{myBean.commandButton}" render="count2" />
    <h:outputText id="count2" value="#{myBean.count}" />
</h:form>

单击此按钮可以正确执行myBean.commandButton,但随后会产生以下所述的错误并刷新页面.

The click on this button correctly executes myBean.commandButton but then produces the error described below and does a "refresh" of the page.

<h:form>
    <p:commandButton value="Primefaces" action="#{myBean.commandButton}" update="count3" />
    <h:outputText id="count3" value="#{myBean.count}" />
</h:form>

单击此按钮可以正确执行myBean.commandButton并使用增加的值呈现输出文本.

The click on this button correctly executes myBean.commandButton and renders the output text with the incremented value.

为了在Weblogic 12.2.1上进行部署,我不得不强制Weblogic通过weblogic-application.xml使用给定的JSF 2.1.6软件包,如所述

In order to deploy on Weblogic 12.2.1, I had to force Weblogic to use the given JSF 2.1.6 package through the weblogic-application.xml as mentioned here, such as :

<prefer-application-packages>
    <package-name>javax.faces.*</package-name>
    <package-name>com.sun.faces.*</package-name>
    <package-name>com.bea.faces.*</package-name>
</prefer-application-packages>

<prefer-application-resources> 
    <resource-name>javax.faces.*</resource-name> 
    <resource-name>com.sun.faces.*</resource-name> 
    <resource-name>com.bea.faces.*</resource-name> 
    <resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
    <resource-name>META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider</resource-name>
    <resource-name>META-INF/resources/javax.faces/jsf.js</resource-name>
</prefer-application-resources>

我非常确定JSF软件包不会冲突,因为FacesContext.class.getPackage().getImplementationVersion()返回2.1.6-SNAPSHOT并且wls-cat工具返回以下冲突的软件包列表,并且JSF的软件包不在其中.

I am pretty sure that JSF packages are not conflicting since FacesContext.class.getPackage().getImplementationVersion() returns 2.1.6-SNAPSHOT and the wls-cat tool returns the following conflicted packages list and JSF's packages are not among them.

但是我注意到,即使我强制Weblogic从我的JSF包中使用META-INF/resources/javax.faces/jsf.js,它实际上也使用了Weblogic的JSF包中的jsf.js文件: 网络浏览器jsf.js

But I notice that even if I force Weblogic to use META-INF/resources/javax.faces/jsf.js from my JSF package, it actually uses the jsf.js file from Weblogic's JSF package : Web browser jsf.js

有冲突的软件包列表:

com.google.common.*
com.sun.mail.*
javax.el.*
javax.mail.*
javax.mail.event.*
javax.mail.internet.*
javax.mail.search.*
javax.mail.util.*
javax.persistence.*
javax.persistence.spi.*
javax.servlet.*
javax.servlet.http.*
javax.servlet.jsp.*
javax.transaction.*
javax.transaction.xa.*
javax.validation.*
javax.validation.bootstrap.*
javax.validation.constraints.*
javax.validation.groups.*
javax.validation.metadata.*
javax.validation.spi.*
net.jcip.annotations.*
net.sf.cglib.*
oracle.core.lmx.*
oracle.core.lvf.*
oracle.jdbc.*
oracle.jdbc.connector.*
oracle.jdbc.driver.*
oracle.jdbc.internal.*
oracle.jdbc.oci.*
oracle.jdbc.oracore.*
oracle.jdbc.pool.*
oracle.jdbc.rowset.*
oracle.jdbc.util.*
oracle.jdbc.xa.*
oracle.jpub.runtime.*
oracle.net.ano.*
oracle.net.jndi.*
oracle.net.ns.*
oracle.net.nt.*
oracle.net.resolver.*
oracle.security.o3logon.*
oracle.sql.*
oracle.sql.converter.*
org.aopalliance.aop.*
org.aopalliance.intercept.*
org.apache.commons.*
org.apache.oro.*
org.apache.xerces.*
org.apache.xmlbeans.*
org.bouncycastle.*
org.bouncycastle.asn1.*
org.bouncycastle.crypto.*
org.bouncycastle.i18n.*
org.bouncycastle.jce.*
org.bouncycastle.math.*
org.bouncycastle.ocsp.*
org.bouncycastle.util.*
org.bouncycastle.x509.*
org.slf4j.*
org.slf4j.helpers.*
org.slf4j.spi.*
org.w3c.dom.*
repackage.*
schemaorg_apache_xmlbeans.system.sXMLCONFIG.*
schemaorg_apache_xmlbeans.system.sXMLLANG.*
schemaorg_apache_xmlbeans.system.sXMLSCHEMA.*
schemaorg_apache_xmlbeans.system.sXMLTOOLS.*

有人对这个问题有想法吗?
预先感谢.

Does anyone have an idea for this problem ?
Thanks in advance.

推荐答案

我终于解决了这个问题:
Servur发送的真实文件不是META-INF/resources/javax.faces/jsf.js而是META-INF/resources/javax.faces/jsf-uncompressed.js.

I finally solved the problem :
The real file sent by the serveur is not META-INF/resources/javax.faces/jsf.js but META-INF/resources/javax.faces/jsf-uncompressed.js.

因此weblogic-application.xml文件必须具有以下配置:

So the weblogic-application.xml file must have the following configuration :

<prefer-application-packages>
    <package-name>javax.faces.*</package-name>
    <package-name>com.sun.faces.*</package-name>
</prefer-application-packages>

<prefer-application-resources> 
    <resource-name>javax.faces.*</resource-name>
    <resource-name>com.sun.faces.*</resource-name>
    <resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
    <resource-name>META-INF/services/com.sun.faces.spi.FacesConfigResourceProvider</resource-name>
    <resource-name>META-INF/resources/javax.faces/jsf.js</resource-name>
    <resource-name>META-INF/resources/javax.faces/jsf-uncompressed.js</resource-name>
</prefer-application-resources>

这篇关于JSF中带有Ajax请求的error @ malformedXML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆