Java.lang.NoSuchMethodError: org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest

I handle file uploads using the multipart filter, as described here . I created a WAR file and deployed to a Weblogic 10.3.3 server and received an error:

<Dec 8, 2011 5:37:07 PM IST> <Error> <HTTP> <BEA-101020> <[ ServletContext@26087289 [app:playground module:playground.war path:/playground spec-version:null]] Servlet failed with Exception java.lang.NoSuchMethodError: org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(Lorg/apache/commons/fileupload/RequestContext;)Ljava/util/List; at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126) at net.balusc.webapp.MultipartFilter.parseRequest(MultipartFilter.java:169) at net.balusc.webapp.MultipartFilter.doFilter(MultipartFilter.java:123) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684) Truncated. see log file for complete stacktrace 

Then I deployed the same WAR file on the Tomcat 7.0.11 server, and it started successfully. How is this caused and how can I successfully deploy to Weblogic?

+4
source share
3 answers

Deployment in Weblogic 10.3.3 results in an error:

java.lang.NoSuchMethodError: org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest (Lorg / apache / commons / fileupload / RequestContext;) Ljava / util / List;

Successful deployment in Tomcat 7.0.11.

Weblogic already comes with the Apache Commons FileUpload libraries. This error indicates that they have an older version than you have in /WEB-INF/lib .

You have at least 3 options:

  • Remove the JAR from /WEB-INF/lib .
  • Replace them with the same version as Weblogic.
  • Modify the Weblogic class loading policy to load classes from the application first.
+6
source

You can use the following API to upload files to the JBoss Server http://commons.apache.org/fileupload/index.html

+2
source

Check if your Jar library has duplicate Jar files with different versions. Delete the file of the old version.

0
source

Source: https://habr.com/ru/post/1384274/


All Articles