简体   繁体   中英

Struts file upload not working with jar files in lib folder

Can someone help me please ? I am stuck and don't have any clue.

I want to upload a file in struts 1.2. I know that struts uses 'commons-io.jar' and 'commons-fileupload.jar' for file upload and I need to place these jars in WebContent / Web-INF / lib folder. I placed the jars in lib folder but application is giving class definition not found error. I tried creating a lib folder and placing these jar files under WEB-INF folder. I also tried adding these jar files in build path but still giving same below error. I also tried using 3 differnet versions (1, 1.4, 2.4) of 'commons-io.jar'.

Can some one help please ?

java.lang.NoClassDefFoundError: org.apache.commons.io.output.DeferredFileOutputStream
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:59)
at java.lang.J9VMInternals.verify(J9VMInternals.jenter code hereava:57)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:120)

This normally happens when the commons-io.jar is missing from your class path Right Click on Your Project . and upload all latest version Commons jar files

  • Right Click On Project.
  • Go to Properties.
  • Go to Library Tab.
  • Add Jar .
  • Clean and Build
  • upload updated war file on tomcat webapp folder.
  • start tomcat . Hope this will Help Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM