0
votes

I'm working on a web application in java where I want to use ServletFileUpload class to upload my file. I've downloaded commons-fileupload-1.2.2.jar and added that jar trough project properties. I'm using jdeveloper 11g and weblogic server.

When I run the application I get : "java.lang.NoSuchMethodError: parseRequest".

here is my code:

List<FileItem> items;
items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);

As I understand my application is probably using older version of the library.

My question is how do I make my application use this new library I've downloaded? Can I do it in though Jdeveloper or I have to change something on the server??

2

2 Answers

0
votes

You can try to set the 'prefer-web-inf-classes' element in the weblogic-application.xml file to true. This then should load classed in the web-inf/lib folder befoer the ones defined in the server.

Read the WebLogic classloading doc to get more info.

0
votes

I found out what was the problem. In my war file in WEB/lib I had two .jar files. commons-fileupload-1.2.2.jar (which I added) and commons-fileupload.jar(this one was in Struts Runtime library). I excluded Struts Runtime from my project(because I didn't need it) and now It works fine.