# JDK1.1.3 applet security exception

steven.j.blumfield (steven.j.blumfield@ac.com)
21 Aug 97 17:01:21

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Roland Schemers: "Re: JDK1.1.3 applet security exception"
- Previous message: Stefan Manzke: "using RSA"
- Next in thread: Roland Schemers: "Re: JDK1.1.3 applet security exception"

    Message-Id: <9708220113.AA8830@notes2.compuserve.com>

    To: marianne mueller <mrm@Eng>

    From: "steven.j.blumfield" <steven.j.blumfield@ac.com>

    Date: 21 Aug 97 17:01:21

    Subject: JDK1.1.3 applet security exception

This is the preamble of an RFC-1341 encoded, mixed message.

---- next item ----
Content-Type: Text/Plain

Hi again,

I sent an email to you about a JDK1.1.2 security exception on 30 June. I never
received a response. I retried exec of this very basic applet with JDK1.1.3
yesterday and am getting a similar result. Please respond ASAP - the
attachments should not take more than a few minutes to check out!

I developed an applet that includes connection to and access from an MS Access
DB on my local workstation. It didn't work. To test this further, I created a
simple applet "HelloAuto" (based on a sample from book "Learn Java Now") - see
attached. The offending line is:

// load the jdbc-odbc driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Compiling: "javac HelloAuto.java <Enter>" works OK.

Exec: Appletviewer HelloAuto.html <Enter> produces the following in the
DOS window.

Before try loop in init()
sun.applet.AppletSecurityException: checkpackageaccess
at
sun.applet.AppletSecurity.checkPackageAccess(AppletSecurity.java:628)
at
sun.applet.AppletClassLoader.LoadClass(AppletClassLoader.java:187)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at HelloAuto.init(HelloAuto.java:56)
at sun.applet.AppletPanel.run(AppletPanel.java:287)
at java.lang.Thread.run(Thread.java:474)
sun.applet.AppletSecurityException: checkpackageaccess
at
sun.applet.AppletSecurity.checkPackageAccess(AppletSecurity.java:628)
at
sun.applet.AppletClassLoader.LoadClass(AppletClassLoader.java:187)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at HelloAuto.init(HelloAuto.java:56)
at sun.applet.AppletPanel.run(AppletPanel.java:287)
at java.lang.Thread.run(Thread.java:474)
Failed:sun.applet.AppletSecurityException: checkpackageaccess

I would appreciate your feedback on this.

Thanks and Regards,
Steve

---- next item ----
Content-Type:Text/Plain; Name="HELLOA~1.JAV"

//******************************************************************************
// HelloAuto.java: Applet
//
//******************************************************************************
import java.applet.*;
import java.awt.*;
import java.sql.*;
import java.util.*;

//==============================================================================
// Main Class for applet HelloAuto
//
//==============================================================================
public class HelloAuto extends Applet
{

// HelloAuto Class Constructor
//--------------------------------------------------------------------------
public HelloAuto()
{
// TODO: Add constructor code here
}

// APPLET INFO SUPPORT:
// The getAppletInfo() method returns a string describing the applet's
// author, copyright date, or miscellaneous information.
//--------------------------------------------------------------------------
public String getAppletInfo()
{
return "Name: HelloAuto\r\n" +
"Author: Steve Blumfield";
}

// The init() method is called by the AWT when an applet is first loaded or
// reloaded. Override this method to perform whatever initialization your
// applet needs, such as initializing data structures, loading images or
// fonts, creating frame windows, setting the layout manager, or adding UI
// components.
//--------------------------------------------------------------------------
public void init()
{ Connection dbConnection;
// If you use a ResourceWizard-generated "control creator" class to
// arrange controls in your applet, you may want to call its
// CreateControls() method from within this method. Remove the following
// call to resize() before adding the call to CreateControls();
// CreateControls() does its own resizing.
//----------------------------------------------------------------------
resize(320, 240);
// Inserted the following to test connection to ODBC DB
System.out.println("Before try loop in init()");
try
{
// load the jdbc-odbc driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// System.out.println("Connecting to jdbc:odbc:" + DSN+","+UID+","+ PWD);
// make the connection to the supplied database
// dbConnection = DriverManager.getConnection("jdbc:odbc:" + DSN, UID, PWD);
}
catch (Exception e) {
System.out.println("Failed:"+e);
}

}

// Place additional applet clean up code here. destroy() is called when
// when you applet is terminating and being unloaded.
//-------------------------------------------------------------------------
public void destroy()
{
// TODO: Place applet cleanup code here
}

// HelloAuto Paint Handler
//--------------------------------------------------------------------------
public void paint(Graphics g)
{
g.drawString("Hello, World", 0, 20);
}

// The start() method is called when the page containing the applet
// first appears on the screen. The AppletWizard's initial implementation
// of this method starts execution of the applet's thread.
//--------------------------------------------------------------------------
public void start()
{
// TODO: Place additional applet start code here
}
// The stop() method is called when the page containing the applet is
// no longer on the screen. The AppletWizard's initial implementation of
// this method stops execution of the applet's thread.
//--------------------------------------------------------------------------
public void stop()
{
}

// TODO: Place additional applet code here

}

---- next item ----
Content-Type:Text/Plain; Name="HELLOA~1.HTM"

HelloAuto

The source.

---- next item ------

- Next message: Roland Schemers: "Re: JDK1.1.3 applet security exception"
- Previous message: Stefan Manzke: "using RSA"
- Next in thread: Roland Schemers: "Re: JDK1.1.3 applet security exception"