I am attempting to upload a picture to a webserver and create a
thumbnail from the picture uploaded. The problem comes in when I
attempt to create an Image object from the File object (which is the
location of the uploaded picture)...I get the following error:
java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:130)
at java.awt.Toolkit$2.run(Toolkit.java:712)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:70 3)
at _admin._addpicture__jsp._jspService(/www/mcmanis.scharlemann.com/admin/addpicture.jsp:89)
at com.caucho.jsp.JavaPage.service(JavaPage.java:74)
at com.caucho.jsp.Page.subservice(Page.java:485)
at com.caucho.server.http.FilterChainPage.doFilter(Fi lterChainPage.java:176)
at com.caucho.server.http.Invocation.service(Invocati on.java:278)
at com.caucho.server.http.ServletServer.serviceTop(Se rvletServer.java:847)
at com.caucho.server.http.HttpRequest.handleRequest(H ttpRequest.java:213)
at com.caucho.server.http.HttpRequest.handleConnectio n(HttpRequest.java:158)
at com.caucho.server.TcpConnection.run(TcpConnection. java:140)
at java.lang.Thread.run(Thread.java:536)
Basically here is what happens. I use a multipart/form-data html form
within my html page to upload the picture to the server. I have no
problem doing this. The picture is saved in a temporary location. I
then attempt to create a thumbnail from the picture with the code from
here: http://www.geocities.com/marcoschmid...thumbnail.html
The problem is...whether in a JavaBean...or directly in the JSP
page...the line where I try to create the Image with the Toolkit
throws the NoClassDefFoundError.
Line 87 in addpicture.jsp is:
Image image = Toolkit.getDefaultToolkit().getImage(
file.getCanonicalPath());
where file is the object pointing to the temporary location of the
uploaded picture. If anyone has any idea how to fix/get arround this
problem I would appreciate any help. Thanks