Announcement Announcement Module
Collapse
No announcement yet.
FileUpload with Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • FileUpload with Spring

    Hi!
    I use the source code from Spring Live Book, Uploading Files, in page 141, but a get this error.
    Have someone some solution to this error. Is it some Jar that is wrong? It looks as it does not find the file DeferredFileOutputStream in org/apache/commons/io/output, but the jar file commons-io-1.3.2.jar is in the Path.


    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
    <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.5"/>
    <classpathentry kind="lib" path="C:/Program Files/mysql-connector-java-5.1.7/mysql-connector-java-5.1.7/mysql-connector-java-5.1.7-bin.jar"/>
    <classpathentry kind="lib" path="C:/Program Files/mysql-connector-java-5.1.7/mysql-connector-java-5.1.7/commons-io-1.3.2.jar"/>
    <classpathentry kind="output" path="build/classes"/>
    </classpath>




    2008-12-04 16:38:31,513 ERROR [org.springframework.web.servlet.DispatcherServlet] - Could not complete request
    org.springframework.web.util.NestedServletExceptio n: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream
    java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream
    at org.apache.commons.fileupload.disk.DiskFileItemFac tory.createItem(DiskFileItemFactory.java:191)
    at org.apache.commons.fileupload.FileUploadBase.parse Request(FileUploadBase.java:350)
    at org.apache.commons.fileupload.servlet.ServletFileU pload.parseRequest(ServletFileUpload.java:126)
    at org.springframework.web.multipart.commons.CommonsM ultipartResolver.resolveMultipart(CommonsMultipart Resolver.java:117)
    at org.springframework.web.servlet.DispatcherServlet. checkMultipart(DispatcherServlet.java:894)
    at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:766)
    at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:723)
    at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:396)
    at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:360)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:647)

    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:174)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:875)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.output.DeferredFileOutputStr eam
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
    at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
    ... 47 more
    2008-12-04 16:38:31,517 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/case1].[case2]] - Servlet.service() for servlet case2 threw exception
    java.lang.ClassNotFoundException: org.apache.commons.io.output.DeferredFileOutputStr eam
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
    at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
    at org.apache.commons.fileupload.disk.DiskFileItemFac tory.createItem(DiskFileItemFactory.java:191)
    at org.apache.commons.fileupload.FileUploadBase.parse Request(FileUploadBase.java:350)
    at org.apache.commons.fileupload.servlet.ServletFileU pload.parseRequest(ServletFileUpload.java:126)

  • #2
    You are running this application in tomcat embedded in eclipse, right?

    Check if the commons-io-x.x.x.jar is in your WEB-INF/lib directory

    Cheers

    G

    Comment


    • #3
      Yes i run Tomcat 5.5 embedded in Eclipse, and commons-io-1.3.2.jar . is in the directory WebContent/WEB-INF/lib/...but i dont work anyway..can it be some jar conflict.

      Comment

      Working...
      X