loader constraint violation: when resolving interf

2019-09-08 06:53发布

I got this error while deploying the WAR in Tomcat 7. I have carried out the development using JDeveloper 11.

"java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.addELResolver(Ljavax/el/ELResolver;)V" 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 p.JspApplicationContext.addELResolver(Ljavax/el/ELResolver;)V used in the signature"

I have googled for the answers and have found answers, but nothing seems to work for my problem. I understand that it is something to do with the JARs that I have in my /WEB-INF/lib, but I don't know which causes the error.

These are the JARs I have in /WEB-INF/lib:

  • adf-controller-api.jar
  • adf-controller-rt-common.jar
  • adf-controller-security.jar
  • adf-controller.jar
  • adf-dt-at-rt.jar
  • adf-richclient-api-11.jar
  • adf-richclient-impl-11.jar
  • adf-share-base.jar
  • adf-share-ca.jar
  • adf-share-security.jar
  • adf-share-support.jar
  • adf-transactions-dt.jar
  • adfdt_common.jar
  • adflibfilter.jar
  • adflogginghandler.jar
  • adfm.jar
  • adfmweb.jar
  • adfsharembean.jar
  • cache.jar
  • commons-el.jar
  • db-ca.jar
  • dvt-databindings.jar
  • dvt-faces.jar
  • dvt-facesbindings.jar
  • dvt-jclient.jar
  • dvt-trinidad.jar
  • dvt-utils.jar
  • glassfish.el_2.2.0.jar
  • glassfish.jsf_1.2.9.0.jar
  • glassfish.jstl_1.2.0.1.jar
  • groovy-all-1.6.3.jar
  • identitystore.jar
  • inspect4.jar
  • javatools-nodeps.jar
  • javax.activation_1.1.0.0_1-1.jar
  • javax.ejb_3.0.1.jar
  • javax.jsf_1.0.0.0_1-2.jar
  • javax.jsp_1.1.0.0_2-1.jar
  • javax.servlet_1.0.0.0_2-5.jar
  • jdev-cm.jar
  • jewt4.jar
  • jsp-el-api.jar
  • ojdbc14.jar
  • ojmisc.jar
  • oracle-el.jar
  • oracle-page-templates.jar
  • share.jar
  • trinidad-api.jar
  • trinidad-impl.jar
  • wls.jsf.di.jar
  • xmlparserv2.jar

How can I solve it?

2条回答
成全新的幸福
2楼-- · 2019-09-08 07:08

I had the same error when migrating a project from WAS6 to WAS 7. Here is the fix:

  1. Update web.xml: a. Open Project_name\src\main\webapp\WEB-INF\web.xml b. Add the following listener:

    Com.sun.faces.config.ConfigureListener

c. Build the project and deploy it to Websphere

  1. Change loader order: a. Open Websphere application server Console b. Go to: Applications >> Application Types >> WebSphere enterprise applications c. Click at the project d. Click “Class loading and update detection” e. Choose “Classes loaded with parent loader first” f. Click Apply

  2. Disable JSP class reloading a. Go to: Applications >> Application Types >> WebSphere enterprise applications b. Click at the project c. Click at JSP and JSF options d. Uncheck “JSP enable class reloading” e. Click OK

  3. Change JSF Implementation a. Go to: Applications >> Application Types >> WebSphere enterprise applications b. Click at the project c. Click at JSP and JSF options d. Choose “MyFaces 1.2” under JSF Implementation

  4. Start the Project

查看更多
仙女界的扛把子
3楼-- · 2019-09-08 07:21

You should not have servletcontainer-specific libraries in your /WEB-INF/lib. At least the following ones are supposed to be already provided by Tomcat itself:

  • glassfish.el_2.2.0.jar
  • javax.jsp_1.1.0.0_2-1.jar
  • javax.servlet_1.0.0.0_2-5.jar
  • jsp-el-api.jar

Remove them. The particular exception is caused by the javax.jsp_1.1.0.0_2-1.jar one, which is different from Tomcat's own one.

See also:

查看更多
登录 后发表回答