user752590
user752590

Reputation: 101

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

I am handling file uploads by a multipart filter as described here. I created a WAR file and deployed on Weblogic 10.3.3 server and got 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 same WAR file on Tomcat 7.0.11 server and it is successfully running. How is this caused and how can I deploy successfully on Weblogic?

Upvotes: 6

Views: 15340

Answers (3)

Sumit Nagrare
Sumit Nagrare

Reputation: 7

Check If your Jar Library has duplicate Jar files with Different versions. Delete the old version file.

Upvotes: 0

BalusC
BalusC

Reputation: 1108632

Deployment on 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;

Deployment on Tomcat 7.0.11 is successful.

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

You have at least 3 options:

  1. Remove the JARs from /WEB-INF/lib.
  2. Replace them by exactly the same version as Weblogic is using.
  3. Change the Weblogic classloading policy to load classes from application first.

Upvotes: 7

Pokuri
Pokuri

Reputation: 3082

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

Upvotes: 2

Related Questions