English

Error: com.ms.security.SecurityExceptionEx[Host]

Error Message

An applet that sends the XML request to the server through AppServerLink and is run from Microsoft Visual J++ returns the following error:

"com.ms.security.SecurityExceptionEx[Host] "

The same applet request run from JBuilder, however, returns properly.

Cause

This error is caused by the sandbox restrictions of the Java Security Model applicable to programs whose applets are run from a Web browser, such as Microsoft Visual J++.

In contrast, JBuilder runs the applets using AppletViewer, a debugging aid for viewing and testing applets, and are not subject to the sandbox restrictions.

Solution or Workaround

Below are two possibilities to bypass this error:

  • RUN APPLET FROM WEBSITE LOCATION
    1. Use Microsoft Visual J++ just to develop and compile the applet.

    2. Copy the class file and HTML file to a public Web site folder and access the HTML file from the Web site location using the HTTP protocol.
  • ASSERT THE NETIO PERMISSION TO THE APPLET USING POLICYENGINE CLASS
    Trusting the applet, as shown in the example below, to access your ArcIMS Host when running locally. Do not assert your permission if an untrusted member of the call stack may harm the user's system.

    Code:
    import com.ms.security.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    public class Applet1 extends Applet {
    //Construct the applet
    public Applet1() {
    }

    //Initialize the applet
    public void init() {

    try {
    if (Class.forName("com.ms.security.PolicyEngine") != null) {
    PolicyEngine.assertPermission(PermissionID.NETIO);
    }
    } catch (Throwable cnfe) {
    }

    }
    }

    Note:
    The best solution is to assert the permission while developing and testing the applet and remove it when deploying on the webserver.

Related Information