When do you get the Exception - during "this.getDocumentBase()" or during "new URL(...)"?
The javadocs say that getDocumentBase returns the full URL, including the HTML filename, and that during "new URL" the "spec" parameter is appended to the "context" parameter if it is not absolute (which yours isn't), so you likely are constructing an invalid URL.
Just curious: Do you really have a
servlet configured to listen to requests into the applet directory?