Hi everyone,
I'm trying to implement file uploading for my website using MultipartRequest's. I'm using jdk1.4.2, Orion Web Server 2.0.2, and NetBeans 3.4.1. And cos-05Nov2002.zip. I keep getting a NoClassDefFoundError, and I have no idea why. When I change the form to "post" instead of "get" none of the parameters are received either. My servlet compiles fine, and other methods in the servlet work fine (processing parameters from the request, outputting HTML).
I've tried with no CLASSPATH variable set, and with it being set to c:\orion;c:\orion\lib. Nothing.
The class I appear to be missing is in c:\orion\orion.jar, so I'm not sure why the server can't find it.
I run the server like this: "java -jar orion.jar".
Thanks in advance, Owen.
The relevant piece of code in the servlet:
public boolean prcCourseFileEdit(HttpServletRequest req) {
System.out.print("prcCourseFileEdit(HttpServletRequest) ... ");
try {
MultipartRequest mr = new MultipartRequest(req, "c:\\");
System.out.println("Filename = " + mr.getFileNames().toString());
return true;
}
catch (Exception e) {System.out.println("ERROR\n" + e); return false;}
}
The relevant HTML page
<html>
<head><title>UniSys - version 947</title>
<link href="..\..\styles001.css" type="text/css" rel="stylesheet">
</head>
<body>
<table class="content"><tr><td>Content: </td></tr><tr><td><br>
<form name="ce" action="UniSys" method="get" enctype="multipart/form-data">
<input type="hidden" name="act" value="1">
<input type="hidden" name="obj" value="16">
<input type="hidden" name="courseFileID" value="4">
<table class="003">
<tr><td>File</td><td><input name="file" type="file"><br><input type="checkbox" name="confirmFileEdit"> Click here to upload a new file and erase the old one.</td></tr>
<tr><td colspan="2" align="center"><input class="but" type="submit" value="Edit This Course File"><input class="but" type="reset" value="Undo Changes"></td></tr>
</table></form></td></tr>
</table>
</td></tr></table>
</body></html>
The error code when submitting a new file:
500 Internal Server Error
java.lang.NoClassDefFoundError: javax/servlet/ServletRequest
at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:222)
at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:109)
at com.oreilly.servlet.MultipartRequest.<init>(MultipartRequest.java:89)
at UniSysServlet.prcCourseFileEdit(UniSysServlet.java:3640)
at UniSysServlet.doAll(UniSysServlet.java:478)
at UniSysServlet.doGet(UniSysServlet.java:758)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
at com.evermind[Orion/2.0.2 (build 11157)]._cub._pod(.:521)
at com.evermind[Orion/2.0.2 (build 11157)]._cub._bmc(.:177)
at com.evermind[Orion/2.0.2 (build 11157)]._ax._ltc(.:666)
at com.evermind[Orion/2.0.2 (build 11157)]._ax._uab(.:191)
at com.evermind[Orion/2.0.2 (build 11157)]._bf.run(.:62)