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.NoCla ssDefFoundError
at java.lang.Class .forName0(Nativ e Method)
at java.lang.Class .forName(Class. java:130)
at java.awt.Toolki t$2.run(Toolkit .java:712)
at java.security.A ccessController .doPrivileged(N ative Method)
at java.awt.Toolki t.getDefaultToo lkit(Toolkit.ja va:703)
at _admin._addpict ure__jsp._jspSe rvice(/www/mcmanis.scharle mann.com/admin/addpicture.jsp: 89)
at com.caucho.jsp. JavaPage.servic e(JavaPage.java :74)
at com.caucho.jsp. Page.subservice (Page.java:485)
at com.caucho.serv er.http.FilterC hainPage.doFilt er(FilterChainP age.java:176)
at com.caucho.serv er.http.Invocat ion.service(Inv ocation.java:27 8)
at com.caucho.serv er.http.Servlet Server.serviceT op(ServletServe r.java:847)
at com.caucho.serv er.http.HttpReq uest.handleRequ est(HttpRequest .java:213)
at com.caucho.serv er.http.HttpReq uest.handleConn ection(HttpRequ est.java:158)
at com.caucho.serv er.TcpConnectio n.run(TcpConnec tion.java:140)
at java.lang.Threa d.run(Thread.ja va: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 NoClassDefFound Error.
Line 87 in addpicture.jsp is:
Image image = Toolkit.getDefa ultToolkit().ge tImage(
file.getCanonic alPath());
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