I have a JSF 1.2 application which I intend to deploy to Weblogic 10.3.4. At local Tomcat environment it works fine. But when I try to deploy it to weblogic I am getting a ClassNotFoundException
on javax.el.ELContextListener
. When I add el-api.jar
file, then I get a LinkageError: loader constraint violation
on javax.EL.ELResolver
. It is a deadly vicious circle.
At first I tried to deploy it as WAR. Then I created an enterprise project so that I can deploy as EAR, but it did not solve the problem. My EAR file structure is fine.
Firstly I got error below,
Caused By: java.lang.ClassNotFoundException: javax.el.ELContextListener
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
When I add el-api-2.2.jar
to /WEB-INF/lib
of WAR or /APP-INF/lib
of EAR, then I get loader constarint error;
com.sun.faces.config.ConfigureListener failed: java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.addELResolver(Ljavax/el/ELResolver;)V" the class loader (instance of weblogic/utils/classloaders/GenericClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ELResolver used in the signature.
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.addELResolver(Ljavax/el/ELResolver;)V" the class loader (instance of weblogic/utils/classloaders/GenericClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ELResolver used in the signature
at com.sun.faces.config.ConfigureListener.registerELResolverAndListenerWithJsp(ConfigureListener.java:582)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:212)
What is the problem with it? I changed my classpath order but result was the same. My web.xml
is declared as Servlet 2.5 and I have the following JARs in /WEB-INF/lib
:
- commons-beanutils-1.7.0.jar
- commons-collections-3.2.jar
- commons-digester-1.8.jar
- commons-logging-1.0.4.jar
- darkX-3.3.3.Final.jar
- glassX-3.3.3.Final.jar
- jsf-api.jar
- jsf-impl.jar
- jstl-1.2.jar
- laguna-3.3.3.Final.jar
- log4j-1.2.14.jar
- poi-3.7-20101029.jar
- quartz-all-1.8.4.jar
- richfaces-api-3.3.3.Final.jar
- richfaces-impl-3.3.3.Final.jar
- richfaces-ui-3.3.3.Final.jar
- scjd12.jar
- slf4j-api-1.6.0.jar
- slf4j-log4j12-1.6.0.jar
- themes-3.3.3.Final.jar
Best Answer
You can try using filtering classloader. weblogic-application.xml file can include something like:
This enables WebLogic's filtering classloader to block your application from seeing the JSF in the container (the javax.faces and myfaces part in this case). You need to keep everything that depends on your library also in your apps classloader, which is why I have facelets in this example. Hope this helps..