上下文:Weblogic 12.2.1 / JSF 2.1.6 / Richfaces 4.2.2 / Primefaces 3.4
我有一个在Weblogic 10.3.6上的JSF应用程序,并且我在Weblogic 12.2.1上成功部署。
我在每次ajax请求后面临以下错误:
Received 'error@malformedXML' event from <input ...
[200] undefined: undefined
当页面中不存在要呈现的组件时,通常会发生此错误,但正如您将在以下代码中看到的那样,情况并非如此:
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;
}
<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,但会产生下面描述的错误并对页面进行“刷新”。
<h:form>
<a4j:commandButton value="Richfaces" action="#{myBean.commandButton}" render="count2" />
<h:outputText id="count2" value="#{myBean.count}" />
</h:form>
单击此按钮会正确执行myBean.commandButton,但会产生下面描述的错误并对页面进行“刷新”。
<h:form>
<p:commandButton value="Primefaces" action="#{myBean.commandButton}" update="count3" />
<h:outputText id="count3" value="#{myBean.count}" />
</h:form>
单击此按钮可正确执行myBean.commandButton并使用递增的值呈现输出文本。
为了在Weblogic 12.2.1上进行部署,我不得不强迫Weblogic通过所提到的here的weblogic-application.xml使用给定的JSF 2.1.6软件包,例如:
<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的包不在其中。
但是我注意到即使我强迫Weblogic使用我的JSF包中的META-INF/resources/javax.faces/jsf.js
,它实际上也使用了Weblogic的JSF包中的jsf.js
文件:
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.*
有没有人对这个问题有所了解?
提前谢谢。
答案 0 :(得分:0)
我终于解决了问题:
服务员发送的真实文件不是META-INF/resources/javax.faces/jsf.js
,而是META-INF/resources/javax.faces/jsf-uncompressed.js
。
因此weblogic-application.xml
文件必须具有以下配置:
<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>