this error always confused me, i could get it working in my first applet, then i tried remaking it from the basics and it threw npe, then i copied the original, deleted everything appart from what was in my 2nd file, and it worked even though the .java was exactly the same?!!?
anyway, i think this is thrown a lot when u are using appletviewer or file://... instead of loading it from a domain (or ip if ur gunna complain at me for saying domain) eg
getCodeBase().getHost() will return "domain"
[getCodeBase() will return a URL datatype]