java.lang.SecurityException: Prohibited package name: java

A

atblock

I created an applet which just attaches an extended TransferHandler to
a gui and it worked fine on my computer...
Online however I got this error: java.lang.SecurityException:
Prohibited package name: java

at java.lang.ClassLoader.defineClass(Unknown Source)

at java.security.SecureClassLoader.defineClass(Unknown Source)

at sun.applet.AppletClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.applet.AppletClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.applet.AppletClassLoader.loadCode(Unknown Source)

at sun.applet.AppletPanel.createApplet(Unknown Source)

at sun.plugin.AppletViewer.createApplet(Unknown Source)

at sun.applet.AppletPanel.runLoader(Unknown Source)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

I signed the applet with keytool and jarsigner and it still happened...
 
A

Andrew Thompson

I created an applet which just attaches an extended TransferHandler to
a gui and it worked fine on my computer...

In AppletViewer? Or in a browser?
Online however I got this error: java.lang.SecurityException:
Prohibited package name: java ....
I signed the applet with keytool and jarsigner and it still happened...

Some things cannot be 'fixed' (as being allowable) simply
by signing the applet. A browser, for example, will *always*
throw an exception if you attempt to exit the VM.

BTW - what package(s) are your classes in?

Andrew T.
 
A

atblock

I checked in AppletViewer and in a Browser and it worked...
There is no package name? (is that possibly the problem?)
 
A

Andrew Thompson

(e-mail address removed) wrote:

Please refrain from top-posting - I find it most confusing.
I checked in AppletViewer and in a Browser and it worked...

What browser (make and version), running which Java?
There is no package name? (is that possibly the problem?)

Probably not. The problem seem to have to do with a class
in the 'java' package - so it looked as if you were trying
to load your own class declared in the 'java' package, or
trying to create one using the classloader.

You said it wouldn't work on the net. What is the URL
where I can see your applet?

Andrew T.
 
A

atblock

Please refrain from top-posting - I find it most confusing.

If what you mean by "top-posting" is posting the response on top, if
people don't like it why did google add this feature into gmail and
google groups?
What browser (make and version), running which Java?

Firefox 1.0.5.4 running java 1.4.2_03
Probably not. The problem seem to have to do with a class
in the 'java' package - so it looked as if you were trying
to load your own class declared in the 'java' package, or
trying to create one using the classloader.

You said it wouldn't work on the net. What is the URL
where I can see your applet?

http://www.landercollege.net/dev/OLDrooming/webwishingwell/index1.php
 
A

Andrew Thompson

If what you mean by "top-posting" is posting the response on top, if
people don't like it why did google add this feature into gmail and
google groups?

Google did not. The 'caret' simply defaults to the top of the text
area.
Besides - Google is not a usenet news group, did not invent usenet
news groups, does not own usenet news groups, and does not
control usenet news groups.
Firefox 1.0.5.4 running java 1.4.2_03

Thanks. I'd hoped there might be some useful info. there,
but not this time.
....

OK. This applet failed before I was asked to 'Accept this
signed code' (or words to that effect). As fas as I can tell,
from that, it is either unsigned, or not properly signed.

Now, when I download the jar file from

http://www.landercollege.net/dev/OLDrooming/webwishingwell/java/Dropper.jar
and look inside it, I can see a Testappl.sf and Testappl.dsa
file, from where it was signed..

That is odd. The only signed .jar I have has the .sf/.dsa
files the same name as the jar file, whereas yours is named
Dropper.jar but the signatures start with Testappl.

I am not sure if it is relevant, but where does the 'Testappl'
name come from?

Andrew T.
 
A

atblock

http://www.landercollege.net/dev/OLDrooming/webwishingwell/java/Dropper.jar
and look inside it, I can see a Testappl.sf and Testappl.dsa
file, from where it was signed..

That is odd. The only signed .jar I have has the .sf/.dsa
files the same name as the jar file, whereas yours is named
Dropper.jar but the signatures start with Testappl.

I am not sure if it is relevant, but where does the 'Testappl'
name come from?

keytool allows you to create alias for to sign all your applets. This,
as my first time signing an applet, followed a simple tutorial and
desided to type it exactly what the tutorial writer wrote, in this case
TestApplet or whatever it was
 
T

Thomas Hawtin

[Andrew Thompason wrote:]
[[email protected] wrote:]
There is no package name? (is that possibly the problem?)
Probably not. The problem seem to have to do with a class
in the 'java' package - so it looked as if you were trying
to load your own class declared in the 'java' package, or
trying to create one using the classloader.

Loading classes into packages with names starting with java. is
prohibited even from trusted source to stop alteration of the Java
library. (You need to use -XBootclasspath/p: (or -J-XBootclasspath/p: in
appletviewer) to do that.)

I'm not about trust code posted to newsgroups, but I did download the
jar and stripped the manifest. The exception I get is:

java.lang.NoClassDefFoundError: Dropper (wrong name: Dropper/Dropper)

Indeed using "javap Dropper" I get:

Compiled from "Dropper.java"
public class Dropper.Dropper extends javax.swing.JApplet{
public Dropper.Dropper();
public void init();
}

Moving the class files into a directory called Dropper solved the
problem. Although you can compile source files with incorrectly named
directories, it's not a good idea. Class files will need to be in the
correct directory. To avoid confusion the convention for packages names
is that they should be all lower case (and preferably a single word).

Tom Hawtin
 
A

atblock

You guys were both wrong...the problem was that i was loading a class
in java/.. when i should have used codebase="java"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top