Java.lang.LinkageError: violation of bootloader restriction: when resolving interface method javax.servlet.jsp.JspApplicationContext.getExpressionFactory ()

I am using JSF 2.0 in the Eclipse IDE. When I tried to implement JSP and Servlet, I get the following error:

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/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/exCrop_jsp, 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 org.apache.jsp.exCrop_jsp._jspInit(exCrop_jsp.java:31) at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49) at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:181) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 

How is this caused and how can I solve it?

+8
jsp servlets jsf jsf-2
source share
2 answers

Your path to classes is a mess.

This particular exception indicates that you are clogged in the webapp /WEB-INF/lib folder with randomly loaded servlet container libraries for the make / version servlet container, which are incompatible with the servletcontainer server where you are actually deploying webapp. A special exception message indicates that your /WEB-INF/lib contains jsp-api.jar , j2ee.jar and / or javaee.jar .

You must delete them. Servletcontainer already comes with JSP. You should never copy / move libraries associated with a servlet container. It will only face the target runtime. If you did this to bypass compilation errors in your IDE, you should have solved it differently. Namely, you must integrate the target servlet container into your IDE, and then link it to the project as a Targeted Runtime. This way, the IDE will automatically use the servletcontainer libraries in the compilation class path.

See also:

  • How to import javax.servlet API into an Eclipse project?
+12
source share

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

  • Update web.xml:
    • Open project_name \ src \ main \ webapp \ WEB-INF \ web.xml
    • Add the following listener: Com.sun.faces.config.ConfigureListener
    • Create a project and deploy it to Websphere
  • Change bootloader order:
    • Open the Websphere Application Server Console
    • Go to: Applications → Application Types → WebSphere Enterprise Applications
    • Click on the project.
    • Click Class Detection and Update Updates
    • Select "Parent Loader Loaded Classes First"
    • Click Apply
  • Disable JSP class reload
    • but. Go to: Applications → Application Types → WebSphere Enterprise Applications
    • Click on the project.
    • Click on JSP and JSF options
    • Uncheck "Reload JSP Class"
    • Click OK
  • JSF implementation change
    • Go to: Applications → Application Types → WebSphere Application Enterprise
    • Click on the project.
    • Click on the JSP and JSF options.
    • Select "MyFaces 1.2" in the JSF implementation
  • Run project
+1
source share

All Articles