weblogic 10.3.4 java.lang.ClassNotFoundException:javax.el.ELContextListener
我有一个 JSF 1.2 应用程序,打算将其部署到 Weblogic 10.3.4。在本地Tomcat环境下运行良好。但是,当我尝试将其部署到 weblogic 时,我在 javax.el.ELContextListener
上收到 ClassNotFoundException
。当我添加 el-api.jar
文件时,我在 javax.EL.ELResolver
上收到 LinkageError:加载器约束违规
。这是一个致命的恶性循环。
起初我尝试将其部署为 WAR。然后我创建了一个企业项目,以便可以部署为EAR,但并没有解决问题。我的 EAR 文件结构很好。
出现以下错误
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)
首先,当我将 el-api-2.2.jar
添加到 WAR 或 /APP-INF/lib< 的
/WEB-INF/lib
时, /code> of EAR,然后我得到 loader constarint 错误;
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)
它有什么问题呢?我更改了类路径顺序,但结果是相同的。我的 web.xml
被声明为 Servlet 2.5,并且我在 /WEB-INF/lib
中有以下 JAR:
- 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.jarquartz
- -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
- 主题-3.3.3.Final 。罐
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
发布评论
评论(3)
如果您仍然收到此错误,即使您做了与 el jars 相关的所有必要更改(我的意思是 Preferred-application-packages 和 weblogic-application.xml 等中的其他内容),我认为您的 web.xml 中有问题文件。
请检查您的 web.xml 中是否有以下行。
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
最后我设法找到解决方案。
jsf-impl jar 包含实现“ELContextListener”接口的“ELContextListenerImpl”类。并且ELContextListener接口包含在服务器路径中的wlfullclient-10.3.X.jar中。
如果服务器路径中没有 wlfullclient jar,则会出现“ClassNotFoundException:javax.el.ELContextListener”错误。如果这次添加 el-api jar 出现此错误,您将收到“LinkageError:加载器约束违规”,因为您使用的 jar 版本与服务器拥有的版本不同。无论如何,在weblogic服务器中创建wlfullclient-10.3.X.jar后问题就会得到解决。
为了创建该 jar,您可以阅读这篇文章: http://wls4mscratch.wordpress.com/2010/06/19/steps-to-build-a-wlfullclient-jar-in-wls-10-0-x-and-wls-10- 3-x/
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
您可以尝试使用过滤类加载器。
weblogic-application.xml 文件可以包含如下内容:
这使得 WebLogic 的过滤类加载器能够阻止您的应用程序看到容器中的 JSF(本例中为 javax.faces 和 myfaces 部分)。您需要将依赖于您的库的所有内容也保留在您的应用程序类加载器中,这就是我在这个示例中使用facelets的原因。
希望这有帮助..
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..