I am generating dynamic component in JSF, this is my faces-config.xml
file:
<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>
I got a linkage error like below
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)
I have added the el-api jar
file in my /WEB-INF/lib
folder. I found one solution, the exclusion of Spring EL due to conflict. Solution is to add below code in pom.xml
, but I don't have that file in my application.
<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>
Where do I need to put this <dependency>
tag? I don't know. In my application I've only faces-config.xml
, application-context.xml
and web.xml
files. My application is on Spring and JSF integration. I'm using Tomcat server. It contains the files context.xml
, web.xml
, server.xml
and tomcat-users.xml
. Where do I need to put that <dependency>
tag? Or is there an alternative solution? I don't want to remove el-api.jar
file.