my dog learned polymorphism*
The moose likes Applets and the fly likes Trouble running Applet that uses the AS400JDBCDriver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Trouble running Applet that uses the AS400JDBCDriver" Watch "Trouble running Applet that uses the AS400JDBCDriver" New topic
Author

Trouble running Applet that uses the AS400JDBCDriver

Chad Schmidt
Greenhorn

Joined: Nov 04, 2003
Posts: 16
Hello,
I am really having a difficult time getting an applet that uses the AS400JDBCDriver class to run in Internet Explorer 6 SP1.
I have the code that creates the database connection class object in the init() method of my applet class wrapped in the following code in order run the applet our of the sandbox.
NOTE: I�m not sure I need to do this but this was the only way to make the AccessController errors disappear from the stack trace.
This code compiles and does not generate errors of any kind.
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
// My code here � it works
return null;
}
});
My problem seems to be with the signed jar files I create and reference in my applet�s APPLET tag ARCHIVE attribute. I have the jt400.jar file copied to my working directory. When I create a policy file that grants all access and use this policy file to run the applet in appletviewer, my reference to this local jt400.jar works fine. I assuming there are no socket security issues when running an applet locally in appletviewer.
When I attempt to run this applet in IE6 SP1 I get the following stack trace:
java.lang.SecurityException: class "AS400QueryApplet$1"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:599)
at java.lang.ClassLoader.defineClass(ClassLoader.java:532)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:157)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at AS400QueryApplet.init(AS400QueryApplet.java:33)
at sun.applet.AppletPanel.run(AppletPanel.java:353)
at java.lang.Thread.run(Thread.java:534)
Here�s my applet code:
<applet code="AS400QueryApplet.class"
archive="sAS400QueryApplet.jar, jt400.jar"
width=500 height=300>
</applet>
The sAS400QueryApplet.jar is a signed jar file the contains the following two files:
AS400QueryApplet.class
ResultSetTableModel.class
Here�s what my policy file reads:
keystore "file:/C:/Temp/JavaTestStuff/userstore";
grant signedBy "chad" {
permission java.net.NetPermission "ppcdev", "resolve, connect";
};

A reference to this policy file has been added to my java.security file located in my �C:\j2sdk1.4.2_02\jre\lib\security� directory.
NOTE: ppcdev is the AS400 host I am attempting to connect to.
The policy file that I use to connect when using appletviewer does not have this java.net.NetPermission entry nor does it grant access to a signer alias. Rather is has the follwing entry:
permission java.security.AllPermission;
Does anyone have experience with this type of applet???
Any help on this would be greatly appreciated since this is my first attempt to create and run an applet that actually does anything useful.
Thanks much
Chad


Chad Schmidt<br />ctschmidt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trouble running Applet that uses the AS400JDBCDriver
 
Similar Threads
Problem in running applets in html
Problem running an applet using appletviewer that uses JDBC
Using AS400JDBCDriver() and AS400() together
problem in an applet
Applet loading problem - How to solve this?