0

java.lang.NoClassDefFoundError: org.apache.commons.fileupload.FileItemFactory at java.lang.Class.forNameImpl(Native Method) ~[?:2.9 (07-25-2018)] at java.lang.Class.forName(Class.java:332) ~[?:2.9 (07-25-2018)] at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:74) ~[esapi-2.0.1.jar:2.0.1] at org.owasp.esapi.ESAPI.httpUtilities(ESAPI.java:121) ~[esapi-2.0.1.jar:2.0.1] at org.owasp.esapi.ESAPI.currentRequest(ESAPI.java:70) ~[esapi-2.0.1.jar:2.0.1]

String output= ESAPI.validator().getValidInput("Validationofinput", str, "SafeString", 1000, false);

java.lang.NoClassDefFoundError: org.apache.commons.fileupload.FileItemFactory at java.lang.Class.forNameImpl(Native Method) ~[?:2.9 (07-25-2018)] at java.lang.Class.forName(Class.java:332) ~[?:2.9 (07-25-2018)] at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:74) ~[esapi-2.0.1.jar:2.0.1] at org.owasp.esapi.ESAPI.httpUtilities(ESAPI.java:121) ~[esapi-2.0.1.jar:2.0.1] at org.owasp.esapi.ESAPI.currentRequest(ESAPI.java:70) ~[esapi-2.0.1.jar:2.0.1] at org.owasp.esapi.reference.Log4JLogger.log(Log4JLogger.java:434) ~[esapi-2.0.1.jar:2.0.1] at org.owasp.esapi.reference.Log4JLogger.warning(Log4JLogger.java:205) ~[esapi-2.0.1.jar:2.0.1] at org.owasp.esapi.reference.DefaultIntrusionDetector.addException(DefaultIntrusionDetector.java:65) ~[esapi-2.0.1.jar:2.0.1] at org.owasp.esapi.reference.validation.StringValidationRule.checkEmpty(StringValidationRule.java:260) ~[esapi-2.0.1.jar:2.0.1] at org.owasp.esapi.reference.validation.StringValidationRule.getValid(StringValidationRule.java:273) ~[esapi-2.0.1.jar:2.0.1] at org.owasp.esapi.reference.DefaultValidator.getValidInput(DefaultValidator.java:214) ~[esapi-2.0.1.jar:2.0.1] at org.owasp.esapi.reference.DefaultValidator.getValidInput(DefaultValidator.java:185) ~[esapi-2.0.1.jar:2.0.1]

Prasad
  • 11
  • 4
  • esapi requires a number of other libraries including commons-fileupload. Make sure all dependencies are included (you can get a lot of help doing that using tools like Gradle or Maven). Apart from that it is hard to help as you have not included how you are defining dependencies in your question. – DanielBarbarian Jun 28 '23 at 10:42
  • It could also possible be due to java version incompabilities with the jar file in question. – DanielBarbarian Jun 28 '23 at 10:47
  • Hello Daniel my application is old web application no maven or gradle it developed using servlets and Jsp and java only I am adding jars(esapijar,commons file upload,commons io jar’s) in buildpath But still application showing this error why i don’t know java 8 and 7 only using in that application – Prasad Jun 29 '23 at 13:20
  • Upgrade to ESAPI 2.5.2.0 (the latest release) and then we can revisit this. But the ESAPI team is so small (only 3 regular contributors), that we unfortunately can only try to help those using the latest release. Also, the 2.0.1 ESAPI release has lots of vulnerabilities, so it's in your best interest to upgrade. (Make sure you carefully read the release notes though.) – Kevin W. Wall Jun 30 '23 at 04:20
  • i am Upgrade to ESAPI 2.5.2.0 (the latest release) But still i am facing same Issue java.lang.NoClassDefFoundError: org.apache.commons.fileupload.FileItemFactory at java.lang.Class.forNameImpl(Native Method) ~[?:2.9 (07-25-2018)] at java.lang.Class.forName(Class.java:332) ~[?:2.9 (07-25-2018)] at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:74) ~[esapi-2.0.1.jar:2.0.1] – Prasad Jul 04 '23 at 11:36

0 Answers0