我在 JSF 中生成动态组件,这是我的faces-config.xml
文件:
<faces-config 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-facesconfig_2_0.xsd"
version="2.0" >
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
<resource-bundle>
<base-name>build</base-name>
<var>build</var>
</resource-bundle>
<resource-bundle>
<base-name>message</base-name>
<var>message</var>
</resource-bundle>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>fr</supported-locale>
<supported-locale>es</supported-locale>
</locale-config>
</application>
我收到如下链接错误
SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.RuntimeException: java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:294)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
我已将el-api jar
文件添加到我的/WEB-INF/lib
文件夹中。我找到了一种解决方案,由于冲突而排除 Spring EL。解决方案是在 中添加以下代码pom.xml
,但我的应用程序中没有该文件。
<dependencies>
<dependency org="org.springframework" name="org.springframework.web.servlet" rev="3.0.5.RELEASE">
<!-- Fix for java.lang.LinkageError: loader constraint violation -->
<exclude name="com.springsource.javax.el" />
</dependency>
</dependencies>
我需要把这个<dependency>
标签放在哪里?我不知道。在我的应用程序中,我只有 faces-config.xml
,application-context.xml
和web.xml
文件。我的应用程序基于 Spring 和 JSF 集成。我正在使用Tomcat服务器。它包含文件context.xml
、web.xml
和. 我需要把那个标签放在哪里?还是有替代解决方案?我不想删除文件。server.xml
tomcat-users.xml
<dependency>
el-api.jar