weblogic 10.3.4 java.lang.ClassNotFoundException:javax.el.E​​LContextListener

发布于 11-28 22:00 字数 3122 浏览 1 评论 0原文

我有一个 JSF 1.2 应用程序,打算将其部署到 Weblogic 10.3.4。在本地Tomcat环境下运行良好。但是,当我尝试将其部署到 weblogic 时,我在 javax.el.E​​LContextListener 上收到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

这个俗人2024-12-05 22:00:13

您可以尝试使用过滤类加载器。
weblogic-application.xml 文件可以包含如下内容:

  <prefer-application-packages>
    <package-name>javax.faces.*</package-name>
    <package-name>com.sun.faces.*</package-name>
    <package-name>org.apache.myfaces.*</package-name>
   </prefer-application-packages>

这使得 WebLogic 的过滤类加载器能够阻止您的应用程序看到容器中的 JSF(本例中为 javax.faces 和 myfaces 部分)。您需要将依赖于您的库的所有内容也保留在您的应用程序类加载器中,这就是我在这个示例中使用facelets的原因。
希望这有帮助..

You can try using filtering classloader.
weblogic-application.xml file can include something like:

  <prefer-application-packages>
    <package-name>javax.faces.*</package-name>
    <package-name>com.sun.faces.*</package-name>
    <package-name>org.apache.myfaces.*</package-name>
   </prefer-application-packages>

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..

温柔戏命师2024-12-05 22:00:13

如果您仍然收到此错误,即使您做了与 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>

If you still get this error even though you did all the changes necessary related to el jars (i mean prefer-application-packages and other stuff in weblogic-application.xml etc.), I think there is something wrong in your web.xml file.
Please check that you have the lines below in your web.xml.

  <context-param>
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
  </context-param>
晚雾2024-12-05 22:00:13

最后我设法找到解决方案。

jsf-impl jar 包含实现“ELContextListener”接口的“ELContextListenerImpl”类。并且ELContextListener接口包含在服务器路径中的wlfullclient-10.3.X.jar中。

如果服务器路径中没有 wlfullclient jar,则会出现“ClassNotFoundException:javax.el.E​​LContextListener”错误。如果这次添加 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/

Finally I manage to find the solution.

jsf-impl jar includes "ELContextListenerImpl" class which implements "ELContextListener" interface. And ELContextListener interface is included in the wlfullclient-10.3.X.jar in the server path.

If you dont have wlfullclient jar in the server path you will have "ClassNotFoundException: javax.el.ELContextListener" error. Getting this error if you add el-api jar this time you will get "LinkageError: loader constraint violation" because versions of jars you used and the server has are different. Anyway the problem will be resolved after creating wlfullclient-10.3.X.jar in the weblogic server.

In order to create that jar you can read this post: http://wls4mscratch.wordpress.com/2010/06/19/steps-to-build-a-wlfullclient-jar-in-wls-10-0-x-and-wls-10-3-x/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文