AccessControlException (createClassLoader)

Hi All,
I am getting an error while calling EJB from an applet.
my weblogic.policy file contains
grant codeBase "file:/d:/weblogic/-" {
all the default permission...from installation
permission java.lang.RuntimePermission "getClassLoader";
permission java.lang.RuntimePermission "createClassLoader";
-Djava.security.policy==d:/weblogic/wlserver6.0/lib/weblogic.policy
am I missing anything
regards
bain
++++++++++++++++++++++++++++++++++++++++++++
Java(TM) Plug-in: Version 1.3.0-C
Using JRE version 1.3.0 Java HotSpot(TM) Client VM
User home directory = C:\WINNT\Profiles\Administrator
Proxy Configuration: no proxy
JAR cache enabled.
Beginning Applet initialization...
caught a SecurityException. That's OK.
java.security.AccessControlException: access denied
(java.lang.RuntimePermission createClassLoader)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkCreateClassLoader(Unknown Source)
at java.lang.ClassLoader.<init>(Unknown Source)
at java.security.SecureClassLoader.<init>(Unknown Source)
at
weblogic.utils.classloaders.GenericClassLoader.<init>(GenericClassLoader.java:88)
at
weblogic.utils.classloaders.GenericClassLoader.<init>(GenericClassLoader.java:80)
at
weblogic.j2ee.ApplicationManager.loadFromNetwork(ApplicationManager.java:233)
at
weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:134)
at weblogic.rjvm.ClassTableEntry.getDescriptor(ClassTableEntry.java:37)
at
weblogic.rjvm.InboundMsgAbbrev.getDescriptor(InboundMsgAbbrev.java:132)
at
weblogic.rjvm.MsgAbbrevInputStream.readClassDescriptor(MsgAbbrevInputStream.java:171)
at
weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:90)
at
weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:114)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:47)
at
weblogic.rmi.internal.BasicRemoteRef.unmarshalReturn(BasicRemoteRef.java:136)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:251)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:225)
at
weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(ServerNamingNode_WLStub.java:121)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.wcomnet.Vector.TestApplet1.lookupHome(TestApplet1.java:268)
at com.wcomnet.Vector.TestApplet1.start(TestApplet1.java:167)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Applet started...

Its not the IP that's restricting you - it's creating a ClassLoader. I don't believe you can create a ClassLoader unless you have all-permissions.

Similar Messages

  • Can't fix a java.security.AccessControlException exception

    Hi.
    I have a webapp running under j2ee with a ContextListener that performs some initialization tasks.
    One of these tasks consists in querying a database and putting the results in a xml file according to an existing xml file that acts as a map for it maps the rows and columns of the result set to elements and attributes in the xml doc (this task is really performed by an EJB that the ContextListener instantiates).
    To do this, at some point the EJB tries to instantiate a new org.w3c.dom.Document object pointing to the xml map file witch, like I said, will be used to 'massaje' the data in the query into a xml format.
    Here's the revelant portion of the code:
    mapDoc = docbuilder.parse(mapfilepath);
    When the EJB tries to do this, the following exception is thrown:
    java.security.AccessControlException: access denied (java.io.FilePermission c:\j2sdkee1.3.1\public_html\iFAQs\xml\temas-map.xml read)
    I've checked the server.policy file and it seems ok, it has a grant section that makes me believe I should have read and write access to all files under public_html:
    grant codeBase "file:${com.sun.enterprise.home}/public_html/-" {
    permission java.lang.RuntimePermission "loadLibrary.*";
    permission java.lang.RuntimePermission "accessClassInPackage.*";
    permission java.lang.RuntimePermission "createClassLoader";
    permission java.lang.RuntimePermission "queuePrintJob";
    permission java.lang.RuntimePermission "modifyThreadGroup";
    permission java.io.FilePermission "<<ALL FILES>>", "read,write";
    Any help will be much appreciated!
    Thanks!
    Best regards,
    Piponline, Portugal

    hi piponline,
    thanx for the question details u have specified, part of ur details are used to solve my problem. i have just copied the permissions statements for servlets to j2ee server section in server.pliciy file
    bye
    kireet

  • AccessControlException: applet, BC4J(as session bean),oracle db, on same server.

    my enviroment
    jdev9i_902
    JDK1.3
    oracle 9i
    oc4j(Jdeveloper oc4j)
    everything is on the same machine.
    I have a BC4J deployed as Session Bean(BMT) on stanalone oc4j(jdeveloper oc4j)
    an applet deployed to oc4j.
    ( I have gone through the HOW TO: Applet Deployment for JDev 3.1)
    when I try to run the applet from IE (http://myhomeURL:8888/myroot/applet.html), I get the following error:(seems like that applet thinks that oracle db is on a different server than the app-server)
    java.lang.ExceptionInInitializerError: java.security.AccessControlException: access denied (java.util.PropertyPermission tunneling.shortcut read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         at java.lang.Boolean.getBoolean(Unknown Source)
         at com.evermind.server.rmi.RMIInitialContextFactory.<clinit>(RMIInitialContextFactory.java:34)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
         at oracle.jbo.client.remote.ejb.ias.AmHomeImpl.remoteLookup(AmHomeImpl.java:101)
         at oracle.jbo.client.remote.ejb.ias.AmHomeImpl.initRemoteHome(AmHomeImpl.java:68)
         at oracle.jbo.client.remote.ejb.ias.AmHomeImpl.<init>(AmHomeImpl.java:41)
         at oracle.jbo.client.remote.ejb.ias.InitialContextImpl.createJboHome(InitialContextImpl.java:17)
         at oracle.jbo.common.JboInitialContext.lookup(JboInitialContext.java:72)
         at javax.naming.InitialContext.lookup(Unknown Source)
         at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:102)
         at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:62)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.instantiateResource(ApplicationPoolImpl.java:1431)
         at oracle.jbo.pool.ResourcePool.createResource(ResourcePool.java:290)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:1082)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:1669)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:289)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:269)
         at oracle.jbo.uicli.mom.JUMetaObjectManager.createApplicationObject(JUMetaObjectManager.java:345)
         at mypackage6.AppletBestill1View.init(AppletBestill1View.java:88)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    cheers
    Russel

    Russel,
    You are seeing bug 2087789. During JNDI lookup, certain system properties are being read. Since you are
    running in a sandvox environment, AccessControl exception is being thrown.
    You will have to either sign your jar files or provide a policy file on the client side which will relax
    some of the restriction.
    Sample Java2 policy file follows
    /** Java2 policy for JAZN/OC4J **/
    /** INSTRUCTIONS **/
    @ /** - set ${oracle.ons.oraclehome} to your $ORACLE_HOME **/
    /** this is automatically set by OPMN **/
    @ /** - set ${localhost.ip} to your OC4J machine's IP address **/
    @ /** - set ${oidhost.ip} to your Oid machine's IP address **/
    @ grant codebase "file:${oracle.ons.oraclehome}/-" {
    permission java.lang.RuntimePermission "createSecurityManager";
    permission java.lang.RuntimePermission "setSecurityManager";
    permission java.lang.RuntimePermission "createClassLoader";
    permission java.util.PropertyPermission "*","read";
    permission java.io.SerializablePermission "enableSubstitution";
    /* JAAS */
    grant codebase "file:${java.home}/jre/lib/ext/jaas.jar" {
    permission java.security.AllPermission;
    @ /* JAAS Login Modules */
    grant codebase "file:${java.home}/jre/lib/ext/jaasmod.jar" {
    permission java.security.AllPermission;
    /* JAZN */
    @ grant codebase "file:${oracle.ons.oraclehome}/j2ee/home/jazn.jar" {
    permission java.security.AllPermission;
    /* OC4J */
    @ grant codebase "file:${oracle.ons.oraclehome}/j2ee/home/oc4j.jar" {
    permission java.security.AllPermission;
    /* DMS - J2EE */
    @ grant codebase "file:${oracle.ons.oraclehome}/lib/dms.jar" {
    permission java.security.AllPermission;
    /* DMS - IAS */
    @ grant codebase "file:${oracle.ons.oraclehome}/dms/lib/dms.jar" {
    permission java.security.AllPermission;
    /* ONS */
    @ grant codebase "file:${oracle.ons.oraclehome}/opmn/lib/ons.jar" {
    permission java.security.AllPermission;
    /* JDBC */
    @ grant codebase "file:${oracle.ons.oraclehome}/jdbc/lib/classes12.jar" {
    permission java.security.AllPermission;
    /* OJSP */
    @ grant codebase "file:${oracle.ons.oraclehome}/j2ee/home/lib/ojsp.jar" {
    permission java.security.AllPermission;
    /* tools.jar - for compiling JSPs */
    @ grant codebase "file:${oracle.ons.oraclehome}/j2ee/home/tools.jar" {
    permission java.security.AllPermission;
    /* J2EE/home */
    @ grant codebase "file:${oracle.ons.oraclehome}/j2ee/home/-" {
    /* DMS grants */
    @ permission java.io.FilePermission "${oracle.ons.oraclehome}/j2ee/-
    ", "write,delete";
    permission java.util.PropertyPermission "oracle.*", "read,write";
    permission java.util.PropertyPermission "java.protocol.handler.pkgs",
    "read,write";
    permission java.util.PropertyPermission "transaction.log", "read";
    permission java.lang.RuntimePermission "createClassLoader";
    permission java.lang.RuntimePermission "setContextClassLoader";
    permission java.util.PropertyPermission "http.singlethreaded.maxsize",
    "read";
    permission java.util.PropertyPermission "*", "read,write";
    /* Default Grants to get things going */
    permission java.security.SecurityPermission "*";
    permission java.io.FilePermission "<<ALL FILES>>", "read";
    permission java.lang.RuntimePermission "getProtectionDomain";
    permission java.lang.RuntimePermission "getClassLoader";     
    permission java.lang.RuntimePermission "loadLibrary.ldapjclnt9";     
    @ permission javax.security.auth.AuthPermission "createLoginContext";
    permission javax.security.auth.AuthPermission "doAs";
    permission javax.security.auth.AuthPermission "doAsPrivileged";
    permission javax.security.auth.AuthPermission "getSubject";     
    permission javax.security.auth.AuthPermission
    "getSubjectFromDomainCombiner";     
    @ permission javax.security.auth.AuthPermission "getLoginConfiguration";
    permission javax.security.auth.AuthPermission "getPolicy";
    permission javax.security.auth.AuthPermission "modifyPrincipals";
    permission java.util.PropertyPermission "java.home", "read";     
    permission java.util.PropertyPermission "user.home", "read";
    permission java.util.PropertyPermission "user.dir", "read,write";
    permission java.util.PropertyPermission "java.security.auth.policy",
    "read,write";
    @ permission java.net.SocketPermission "*.us.oracle.com",
    "accept,resolve";
    @ permission java.net.SocketPermission "127.0.0.1",
    "accept,connect,resolve";
    @ permission java.net.SocketPermission "${localhost.ip}",
    "accept,connect,resolve";
    @ permission java.net.SocketPermission "${oidhost.ip}",
    "accept,connect,resolve";
    /* JAZN Permissions */
    permission oracle.security.jazn.JAZNPermission "getCredentials";
    permission oracle.security.jazn.JAZNPermission "setCredentials";
    permission oracle.security.jazn.JAZNPermission "getClearCredentials";
    permission oracle.security.jazn.JAZNPermission
    "setClearCredentialsNoCheck";
    permission oracle.security.jazn.JAZNPermission "getProperty.*";
    permission oracle.security.jazn.JAZNPermission "getPolicy";
    permission oracle.security.jazn.JAZNPermission "getRealmManager";
    permission oracle.security.jazn.policy.AdminPermission
    "java.io.FilePermission$/tmp/*$read,write";
    permission oracle.security.jazn.policy.AdminPermission
    "java.io.FilePermission$/teams/jazn/*$read,write";
    permission oracle.security.jazn.policy.AdminPermission
    "oracle.security.jazn.realm.RealmPermission$*$createRealm,dropRealm,createR
    ole,dropRole,modifyRealmMetaData";
    permission oracle.security.jazn.realm.RealmPermission "*",
    "createRealm";
    permission oracle.security.jazn.realm.RealmPermission "*",
    "dropRealm";     
    permission oracle.security.jazn.realm.RealmPermission "*",
    "createRole";
    permission oracle.security.jazn.realm.RealmPermission "*", "dropRole";
    permission oracle.security.jazn.realm.RealmPermission "*",
    "modifyRealmMetaData";
    permission oracle.security.jazn.policy.RoleAdminPermission "*";
    permission oracle.security.jazn.policy.AdminPermission
    "oracle.security.jazn.policy.RoleAdminPermission$*";      
    my enviroment
    jdev9i_902
    JDK1.3
    oracle 9i
    oc4j(Jdeveloper oc4j)
    everything is on the same machine.
    I have a BC4J deployed as Session Bean(BMT) on stanalone oc4j(jdeveloper oc4j)
    an applet deployed to oc4j.
    ( I have gone through the HOW TO: Applet Deployment for JDev 3.1)
    when I try to run the applet from IE (http://myhomeURL:8888/myroot/applet.html), I get the following error:(seems like that applet thinks that oracle db is on a different server than the app-server)
    java.lang.ExceptionInInitializerError: java.security.AccessControlException: access denied (java.util.PropertyPermission tunneling.shortcut read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         at java.lang.Boolean.getBoolean(Unknown Source)
         at com.evermind.server.rmi.RMIInitialContextFactory.<clinit>(RMIInitialContextFactory.java:34)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
         at oracle.jbo.client.remote.ejb.ias.AmHomeImpl.remoteLookup(AmHomeImpl.java:101)
         at oracle.jbo.client.remote.ejb.ias.AmHomeImpl.initRemoteHome(AmHomeImpl.java:68)
         at oracle.jbo.client.remote.ejb.ias.AmHomeImpl.<init>(AmHomeImpl.java:41)
         at oracle.jbo.client.remote.ejb.ias.InitialContextImpl.createJboHome(InitialContextImpl.java:17)
         at oracle.jbo.common.JboInitialContext.lookup(JboInitialContext.java:72)
         at javax.naming.InitialContext.lookup(Unknown Source)
         at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:102)
         at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:62)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.instantiateResource(ApplicationPoolImpl.java:1431)
         at oracle.jbo.pool.ResourcePool.createResource(ResourcePool.java:290)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:1082)
         at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:1669)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:289)
         at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:269)
         at oracle.jbo.uicli.mom.JUMetaObjectManager.createApplicationObject(JUMetaObjectManager.java:345)
         at mypackage6.AppletBestill1View.init(AppletBestill1View.java:88)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    cheers
    Russel

  • Applet Error:java.security.AccessControlException: access denied

    Hi,
    I just successful deploy an business component project to oralce 8.1.6 as an EJB Session bean, and
    the test of application module is successful. In the same workspace, I create an new project with
    an applet(which contains only an grid control)as a client of the business component. Everything works
    fine within the Applet viewer, however, when I trying to load the applet in IE5.5 I got the following
    error message in java console:
    Java(TM) Plug-in
    Using JRE version 1.2.1
    User home directory = D:\Documents and Settings\ERic
    Proxy Configuration: no proxy
    JAR cache enabled.
    Failed to query environment: 'access denied (java.util.PropertyPermission jbo.debugoutput read)'
    Diagnostics: Silencing all diagnostic output (use -Djbo.debugoutput=console to see it)
    Failed to query environment: 'access denied (java.util.PropertyPermission jbo.logging.show.timing read)'
    Failed to query environment: 'access denied (java.util.PropertyPermission jbo.logging.show.function read)'
    Failed to query environment: 'access denied (java.util.PropertyPermission jbo.logging.show.level read)'
    Failed to query environment: 'access denied (java.util.PropertyPermission jbo.logging.show.linecount read)'
    Failed to query environment: 'access denied (java.util.PropertyPermission jbo.logging.trace.threshold read)'
    Failed to query environment: 'access denied (java.util.PropertyPermission jbo.jdbc.driver.verbose read)'
    java.lang.ExceptionInInitializerError: java.security.AccessControlException: access denied (java.util.PropertyPermission org.omg.CORBA.ORBClass read)
    at java.security.AccessControlContext.checkPermission(Compiled Code)
    at oracle.aurora.jndi.orb_dep.Orb.<clinit>(Orb.java:24)
    at oracle.aurora.jndi.sess_iiop.sess_iiopURLContext.<clinit>(sess_iiopURLContext.java:9)
    at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:588)
    at javax.naming.spi.NamingManager.getURLContext(NamingManager.java:537)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:274)
    at javax.naming.InitialContext.lookup(InitialContext.java:349)
    at oracle.jbo.client.remote.ejb.aurora.AuroraEJBAmHomeImpl.connectToService(AuroraEJBAmHomeImpl.java:179)
    at oracle.jbo.client.remote.ejb.aurora.AuroraEJBAmHomeImpl.createSession(AuroraEJBAmHomeImpl.java:152)
    at oracle.jbo.client.remote.ejb.aurora.AuroraEJBAmHomeImpl.initRemoteHome(AuroraEJBAmHomeImpl.java:123)
    at oracle.jbo.client.remote.ejb.aurora.AuroraEJBAmHomeImpl.<init>(AuroraEJBAmHomeImpl.java:59)
    at oracle.jbo.client.remote.ejb.aurora.AuroraEJBInitialContext.createJboHome(AuroraEJBInitialContext.java:47)
    at oracle.jbo.common.JboInitialContext.lookup(JboInitialContext.java:72)
    at javax.naming.InitialContext.lookup(InitialContext.java:349)
    at oracle.dacf.dataset.SessionInfo._createAppModule(SessionInfo.java:2330)
    at oracle.dacf.dataset.SessionInfo.connect(SessionInfo.java:1799)
    at oracle.dacf.dataset.SessionInfo.openProducerObject(SessionInfo.java:1848)
    at oracle.dacf.dataset.ProducerObject.open(ProducerObject.java:94)
    at oracle.dacf.dataset.SessionInfo.publishSession(SessionInfo.java:1305)
    at oracle.dacf.dataset.SessionInfo.publishSession(SessionInfo.java:1287)
    at broadcastapplet.myBroadCastApplet.init(myBroadCastApplet.java:70)
    at sun.applet.AppletPanel.run(Compiled Code)
    at java.lang.Thread.run(Thread.java:479)
    The Oracle 8.1.6 runs on Win2000, I put the JAR & related zip files in the same machine's IIS webserver.
    Is anyone can help?
    ERic

    Hi Shaji,
    Are you calling a webservice from within an Xacute Query for your applet?  On first glance, it looks like a web service call is being rejected due to security permissions.  If you have a webservice call (or HTTP post/get), can you test it separately with the same credentials as the webpage is using?
    Regards,
    Mike

  • How can i deal with java.security.AccessControlException?

    Hi all, I need to implement JavaMail using Servlet and deploy throught J2EE deployment tool. But when i test out the servlet i will always encounter this exception thrown. How can i solve this?
    java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
    This is the servlet i am testing. Please advise. Thanks in advance!
    * @(#)JavaMailServlet.java     1.3 99/12/06
    * Copyright 1998, 1999 Sun Microsystems, Inc. All Rights Reserved.
    * This software is the proprietary information of Sun Microsystems, Inc.
    * Use is subject to license terms.
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    * This is a servlet that demonstrates the use of JavaMail APIs
    * in a 3-tier application. It allows the user to login to an
    * IMAP store, list all the messages in the INBOX folder, view
    * selected messages, compose and send a message, and logout.
    * <p>
    * Please note: This is NOT an example of how to write servlets!
    * This is simply to show that JavaMail can be used in a servlet.
    * <p>
    * For more information on this servlet, see the
    * JavaMailServlet.README.txt file.
    * <p>
    * For more information on servlets, see
    * * http://java.sun.com/products/java-server/servlets/index.html
    * @author Max Spivak
    public class JavaMailServlet extends HttpServlet implements SingleThreadModel {
    String protocol = "POP3";
    String mbox = "INBOX";
    * This method handles the "POST" submission from two forms: the
    * login form and the message compose form. The login form has the
    * following parameters: <code>hostname</code>, <code>username</code>,
    * and <code>password</code>. The <code>send</code> parameter denotes
    * that the method is processing the compose form submission.
    public void doPost(HttpServletRequest req, HttpServletResponse res)
         throws ServletException, IOException {
    // get the session
         HttpSession ssn = req.getSession(true);
         String send = req.getParameter("send");
    String host = req.getParameter("hostname");
    String user = req.getParameter("username");
    String passwd = req.getParameter("password");
    URLName url = new URLName(protocol, host, -1, mbox, user, passwd);
    ServletOutputStream out = res.getOutputStream();
         res.setContentType("text/html");
         out.println("<html><body bgcolor=\"#CCCCFF\">");
         if (send != null) {
         // process message sending
         send(req, res, out, ssn);
         } else {
         // initial login
         // create
         MailUserData mud = new MailUserData(url);
         ssn.putValue("javamailservlet", mud);
         try {
              Properties props = System.getProperties();
              System.out.println("url");
              props.put("mail.smtp.host", host);
              Session session = Session.getDefaultInstance(props, null);
              session.setDebug(false);
              Store store = session.getStore(url);
              store.connect();
              Folder folder = store.getDefaultFolder();
              if (folder == null)
              throw new MessagingException("No default folder");
              folder = folder.getFolder(mbox);
              if (folder == null)
              throw new MessagingException("Invalid folder");
              folder.open(Folder.READ_WRITE);
              int totalMessages = folder.getMessageCount();
              Message[] msgs = folder.getMessages();
              FetchProfile fp = new FetchProfile();
              fp.add(FetchProfile.Item.ENVELOPE);
              folder.fetch(msgs, fp);
              // track who logged in
              System.out.println("Login from: " + store.getURLName());
              // save stuff into MUD
              mud.setSession(session);
              mud.setStore(store);
              mud.setFolder(folder);
              // splash
              out.print("<center>");
              out.print("<font face=\"Arial,Helvetica\" font size=+3>");
              out.println("<b>Welcome to JavaMail!</b></font></center><p>");
              // folder table
              out.println("<table width=\"50%\" border=0 align=center>");
              // folder name column header
              out.print("<tr><td width=\"75%\" bgcolor=\"#ffffcc\">");
              out.print("<font face=\"Arial,Helvetica\" font size=-1>");
              out.println("<b>FolderName</b></font></td><br>");
              // msg count column header
              out.print("<td width=\"25%\" bgcolor=\"#ffffcc\">");
              out.print("<font face=\"Arial,Helvetica\" font size=-1>");
              out.println("<b>Messages</b></font></td><br>");
              out.println("</tr>");
              // folder name
              out.print("<tr><td width=\"75%\" bgcolor=\"#ffffff\">");
              out.print("<a href=\"" + HttpUtils.getRequestURL(req) + "\">" +
                   "Inbox" + "</a></td><br>");
              // msg count
              out.println("<td width=\"25%\" bgcolor=\"#ffffff\">" +
                   totalMessages + "</td>");
              out.println("</tr>");
              out.println("</table");
         } catch (Exception ex) {
              out.println(ex.toString());
         } finally {
              out.println("</body></html>");
              out.close();
    * This method handles the GET requests for the client.
    public void doGet (HttpServletRequest req, HttpServletResponse res)
         throws ServletException, IOException {
    HttpSession ses = req.getSession(false); // before we write to out
    ServletOutputStream out = res.getOutputStream();
         MailUserData mud = getMUD(ses);
         if (mud == null) {
         res.setContentType("text/html");
         out.println("<html><body>Please Login (no session)</body></html>");
         out.close();
         return;
         if (!mud.getStore().isConnected()) {
         res.setContentType("text/html");
         out.println("<html><body>Not Connected To Store</body></html>");
         out.close();
         return;
         // mux that takes a GET request, based on parameters figures
         // out what it should do, and routes it to the
         // appropriate method
         // get url parameters
         String msgStr = req.getParameter("message");
    String logout = req.getParameter("logout");
         String compose = req.getParameter("compose");
         String part = req.getParameter("part");
         int msgNum = -1;
         int partNum = -1;
         // process url params
         if (msgStr != null) {
         // operate on message "msgStr"
         msgNum = Integer.parseInt(msgStr);
         if (part == null) {
              // display message "msgStr"
    res.setContentType("text/html");
              displayMessage(mud, req, out, msgNum);
         } else if (part != null) {
              // display part "part" in message "msgStr"
              partNum = Integer.parseInt(part);
    displayPart(mud, msgNum, partNum, out, res);
         } else if (compose != null) {
         // display compose form
         compose(mud, res, out);
    } else if (logout != null) {
         // process logout
    try {
    mud.getFolder().close(false);
    mud.getStore().close();
              ses.invalidate();
    out.println("<html><body>Logged out OK</body></html>");
    } catch (MessagingException mex) {
    out.println(mex.toString());
         } else {
         // display headers
         displayHeaders(mud, req, out);
    /* main method to display messages */
    private void displayMessage(MailUserData mud, HttpServletRequest req,
                        ServletOutputStream out, int msgNum)
         throws IOException {
         out.println("<html>");
    out.println("<HEAD><TITLE>JavaMail Servlet</TITLE></HEAD>");
         out.println("<BODY bgcolor=\"#ccccff\">");
         out.print("<center><font face=\"Arial,Helvetica\" ");
         out.println("font size=\"+3\"><b>");
         out.println("Message " + (msgNum+1) + " in folder " +
              mud.getStore().getURLName() +
              "/INBOX</b></font></center><p>");
         try {
         Message msg = mud.getFolder().getMessage(msgNum);
         // first, display this message's headers
         displayMessageHeaders(mud, msg, out);
         // and now, handle the content
         Object o = msg.getContent();
         //if (o instanceof String) {
         if (msg.isMimeType("text/plain")) {
              out.println("<pre>");
              out.println((String)o);
              out.println("</pre>");
         //} else if (o instanceof Multipart){
         } else if (msg.isMimeType("multipart/*")) {
              Multipart mp = (Multipart)o;
              int cnt = mp.getCount();
              for (int i = 0; i < cnt; i++) {
              displayPart(mud, msgNum, mp.getBodyPart(i), i, req, out);
         } else {
              out.println(msg.getContentType());
         } catch (MessagingException mex) {
         out.println(mex.toString());
         out.println("</BODY></html>");
         out.close();
    * This method displays a message part. <code>text/plain</code>
    * content parts are displayed inline. For all other parts,
    * a URL is generated and displayed; clicking on the URL
    * brings up the part in a separate page.
    private void displayPart(MailUserData mud, int msgNum, Part part,
                   int partNum, HttpServletRequest req,
                   ServletOutputStream out)
         throws IOException {
         if (partNum != 0)
         out.println("<p><hr>");
    try {
         String sct = part.getContentType();
         if (sct == null) {
              out.println("invalid part");
              return;
         ContentType ct = new ContentType(sct);
         if (partNum != 0)
              out.println("<b>Attachment Type:</b> " +
                   ct.getBaseType() + "<br>");
         if (ct.match("text/plain")) {
              // display text/plain inline
              out.println("<pre>");
              out.println((String)part.getContent());
              out.println("</pre>");
         } else {
              // generate a url for this part
              String s;
              if ((s = part.getFileName()) != null)
              out.println("<b>Filename:</b> " + s + "<br>");
              s = null;
              if ((s = part.getDescription()) != null)
              out.println("<b>Description:</b> " + s + "<br>");
              out.println("<a href=\"" +
                   HttpUtils.getRequestURL(req) +
                   "?message=" +
                   msgNum + "&part=" +
                   partNum + "\">Display Attachment</a>");
         } catch (MessagingException mex) {
         out.println(mex.toString());
    * This method gets the stream from for a given msg part and
    * pushes it out to the browser with the correct content type.
    * Used to display attachments and relies on the browser's
    * content handling capabilities.
    private void displayPart(MailUserData mud, int msgNum,
                   int partNum, ServletOutputStream out,
                   HttpServletResponse res)
         throws IOException {
         Part part = null;
    try {
         Message msg = mud.getFolder().getMessage(msgNum);
         Multipart mp = (Multipart)msg.getContent();
         part = mp.getBodyPart(partNum);
         String sct = part.getContentType();
         if (sct == null) {
              out.println("invalid part");
              return;
         ContentType ct = new ContentType(sct);
         res.setContentType(ct.getBaseType());
         InputStream is = part.getInputStream();
         int i;
         while ((i = is.read()) != -1)
              out.write(i);
         out.flush();
         out.close();
         } catch (MessagingException mex) {
         out.println(mex.toString());
    * This is a utility message that pretty-prints the message
    * headers for message that is being displayed.
    private void displayMessageHeaders(MailUserData mud, Message msg,
                        ServletOutputStream out)
         throws IOException {
         try {
         out.println("<b>Date:</b> " + msg.getSentDate() + "<br>");
    Address[] fr = msg.getFrom();
    if (fr != null) {
    boolean tf = true;
    out.print("<b>From:</b> ");
    for (int i = 0; i < fr.length; i++) {
    out.print(((tf) ? " " : ", ") + getDisplayAddress(fr));
    tf = false;
    out.println("<br>");
    Address[] to = msg.getRecipients(Message.RecipientType.TO);
    if (to != null) {
    boolean tf = true;
    out.print("<b>To:</b> ");
    for (int i = 0; i < to.length; i++) {
    out.print(((tf) ? " " : ", ") + getDisplayAddress(to[i]));
    tf = false;
    out.println("<br>");
    Address[] cc = msg.getRecipients(Message.RecipientType.CC);
    if (cc != null) {
    boolean cf = true;
    out.print("<b>CC:</b> ");
    for (int i = 0; i < cc.length; i++) {
    out.print(((cf) ? " " : ", ") + getDisplayAddress(cc[i]));
              cf = false;
    out.println("<br>");
         out.print("<b>Subject:</b> " +
              ((msg.getSubject() !=null) ? msg.getSubject() : "") +
              "<br>");
    } catch (MessagingException mex) {
         out.println(msg.toString());
    * This method displays the URL's for the available commands and the
    * INBOX headerlist
    private void displayHeaders(MailUserData mud,
                        HttpServletRequest req,
    ServletOutputStream out)
         throws IOException {
    SimpleDateFormat df = new SimpleDateFormat("EE M/d/yy");
    out.println("<html>");
    out.println("<HEAD><TITLE>JavaMail Servlet</TITLE></HEAD>");
         out.println("<BODY bgcolor=\"#ccccff\"><hr>");
         out.print("<center><font face=\"Arial,Helvetica\" font size=\"+3\">");
         out.println("<b>Folder " + mud.getStore().getURLName() +
              "/INBOX</b></font></center><p>");
         // URL's for the commands that are available
         out.println("<font face=\"Arial,Helvetica\" font size=\"+3\"><b>");
    out.println("<a href=\"" +
              HttpUtils.getRequestURL(req) +
              "?logout=true\">Logout</a>");
    out.println("<a href=\"" +
              HttpUtils.getRequestURL(req) +
              "?compose=true\" target=\"compose\">Compose</a>");
         out.println("</b></font>");
         out.println("<hr>");
         // List headers in a table
    out.print("<table cellpadding=1 cellspacing=1 "); // table
         out.println("width=\"100%\" border=1>"); // settings
         // sender column header
         out.println("<tr><td width=\"25%\" bgcolor=\"ffffcc\">");
         out.println("<font face=\"Arial,Helvetica\" font size=\"+1\">");
         out.println("<b>Sender</b></font></td>");
         // date column header
         out.println("<td width=\"15%\" bgcolor=\"ffffcc\">");
         out.println("<font face=\"Arial,Helvetica\" font size=\"+1\">");
         out.println("<b>Date</b></font></td>");
         // subject column header
         out.println("<td bgcolor=\"ffffcc\">");
         out.println("<font face=\"Arial,Helvetica\" font size=\"+1\">");
         out.println("<b>Subject</b></font></td></tr>");
         try {
         Folder f = mud.getFolder();
         int msgCount = f.getMessageCount();
         Message m = null;
         // for each message, show its headers
         for (int i = 1; i <= msgCount; i++) {
    m = f.getMessage(i);
              // if message has the DELETED flag set, don't display it
              if (m.isSet(Flags.Flag.DELETED))
              continue;
              // from
    out.println("<tr valigh=middle>");
    out.print("<td width=\"25%\" bgcolor=\"ffffff\">");
              out.println("<font face=\"Arial,Helvetica\">" +
                   ((m.getFrom() != null) ?
                   m.getFrom()[0].toString() :
                   "" ) +
                   "</font></td>");
              // date
    out.print("<td nowrap width=\"15%\" bgcolor=\"ffffff\">");
              out.println("<font face=\"Arial,Helvetica\">" +
    df.format((m.getSentDate()!=null) ?
                        m.getSentDate() : m.getReceivedDate()) +
                   "</font></td>");
              // subject & link
    out.print("<td bgcolor=\"ffffff\">");
              out.println("<font face=\"Arial,Helvetica\">" +
              "<a href=\"" +
                   HttpUtils.getRequestURL(req) +
    "?message=" +
    i + "\">" +
    ((m.getSubject() != null) ?
                   m.getSubject() :
                   "<i>No Subject</i>") +
    "</a>" +
    "</font></td>");
    out.println("</tr>");
         } catch (MessagingException mex) {
         out.println("<tr><td>" + mex.toString() + "</td></tr>");
         mex.printStackTrace();
         out.println("</table>");
         out.println("</BODY></html>");
         out.flush();
         out.close();
    * This method handles the request when the user hits the
    * <i>Compose</i> link. It send the compose form to the browser.
    private void compose(MailUserData mud, HttpServletResponse res,
                   ServletOutputStream out)
         throws IOException {
         res.setContentType("text/html");
         out.println(composeForm);
         out.close();
    * This method processes the send request from the compose form
    private void send(HttpServletRequest req, HttpServletResponse res,
              ServletOutputStream out, HttpSession ssn)
         throws IOException {
    String to = req.getParameter("to");
         String cc = req.getParameter("cc");
         String subj = req.getParameter("subject");
         String text = req.getParameter("text");
         try {
         MailUserData mud = getMUD(ssn);
         if (mud == null)
              throw new Exception("trying to send, but not logged in");
         Message msg = new MimeMessage(mud.getSession());
         InternetAddress[] toAddrs = null, ccAddrs = null;
         if (to != null) {
              toAddrs = InternetAddress.parse(to, false);
              msg.setRecipients(Message.RecipientType.TO, toAddrs);
         } else
              throw new MessagingException("No \"To\" address specified");
         if (cc != null) {
              ccAddrs = InternetAddress.parse(cc, false);
              msg.setRecipients(Message.RecipientType.CC, ccAddrs);
         if (subj != null)
              msg.setSubject(subj);
         URLName u = mud.getURLName();
         msg.setFrom(new InternetAddress(u.getUsername() + "@" +
                             u.getHost()));
         if (text != null)
              msg.setText(text);
         Transport.send(msg);
         out.println("<h1>Message sent successfully</h1></body></html>");
         out.close();
         } catch (Exception mex) {
         out.println("<h1>Error sending message.</h1>");
         out.println(mex.toString());
         out.println("<br></body></html>");
    // utility method; returns a string suitable for msg header display
    private String getDisplayAddress(Address a) {
    String pers = null;
    String addr = null;
    if (a instanceof InternetAddress &&
    ((pers = ((InternetAddress)a).getPersonal()) != null)) {
         addr = pers + " "+"<"+((InternetAddress)a).getAddress()+">";
    } else
    addr = a.toString();
    return addr;
    // utility method; retrieve the MailUserData
    // from the HttpSession and return it
    private MailUserData getMUD(HttpSession ses) throws IOException {
         MailUserData mud = null;
         if (ses == null) {
         return null;
         } else {
         if ((mud = (MailUserData)ses.getValue("javamailservlet")) == null){
              return null;
         return mud;
    public String getServletInfo() {
    return "A mail reader servlet";
    * This is the HTML code for the compose form. Another option would
    * have been to use a separate html page.
    private static String composeForm = "<HTML><HEAD><TITLE>JavaMail Compose</TITLE></HEAD><BODY BGCOLOR=\"#CCCCFF\"><FORM ACTION=\"/servlet/JavaMailServlet\" METHOD=\"POST\"><input type=\"hidden\" name=\"send\" value=\"send\"><P ALIGN=\"CENTER\"><B><FONT SIZE=\"4\" FACE=\"Verdana, Arial, Helvetica\">JavaMail Compose Message</FONT></B><P><TABLE BORDER=\"0\" WIDTH=\"100%\"><TR><TD WIDTH=\"16%\" HEIGHT=\"22\">     <P ALIGN=\"RIGHT\"><B><FONT FACE=\"Verdana, Arial, Helvetica\">To:</FONT></B></TD><TD WIDTH=\"84%\" HEIGHT=\"22\"><INPUT TYPE=\"TEXT\" NAME=\"to\" SIZE=\"30\"> <FONT SIZE=\"1\" FACE=\"Verdana, Arial, Helvetica\"> (separate addresses with commas)</FONT></TD></TR><TR><TD WIDTH=\"16%\"><P ALIGN=\"RIGHT\"><B><FONT FACE=\"Verdana, Arial, Helvetica\">CC:</FONT></B></TD><TD WIDTH=\"84%\"><INPUT TYPE=\"TEXT\" NAME=\"cc\" SIZE=\"30\"> <FONT SIZE=\"1\" FACE=\"Verdana, Arial, Helvetica\"> (separate addresses with commas)</FONT></TD></TR><TR><TD WIDTH=\"16%\"><P ALIGN=\"RIGHT\"><B><FONT FACE=\"Verdana, Arial, Helvetica\">Subject:</FONT></B></TD><TD WIDTH=\"84%\"><INPUT TYPE=\"TEXT\" NAME=\"subject\" SIZE=\"55\"></TD></TR><TR><TD WIDTH=\"16%\"> </TD><TD WIDTH=\"84%\"><TEXTAREA NAME=\"text\" ROWS=\"15\" COLS=\"53\"></TEXTAREA></TD></TR><TR><TD WIDTH=\"16%\" HEIGHT=\"32\"> </TD><TD WIDTH=\"84%\" HEIGHT=\"32\"><INPUT TYPE=\"SUBMIT\" NAME=\"Send\" VALUE=\"Send\"><INPUT TYPE=\"RESET\" NAME=\"Reset\" VALUE=\"Reset\"></TD></TR></TABLE></FORM></BODY></HTML>";
    * This class is used to store session data for each user's session. It
    * is stored in the HttpSession.
    class MailUserData {
    URLName url;
    Session session;
    Store store;
    Folder folder;
    public MailUserData(URLName urlname) {
         url = urlname;
    public URLName getURLName() {
         return url;
    public Session getSession() {
         return session;
    public void setSession(Session s) {
         session = s;
    public Store getStore() {
         return store;
    public void setStore(Store s) {
         store = s;
    public Folder getFolder() {
         return folder;
    public void setFolder(Folder f) {
         folder = f;

    You posted a thousand lines of badly-formatted code and didn't have the sense to say which one had the exception.
    My guess is that it was this one:Session session = Session.getDefaultInstance(props, null);because that happened to me. I fixed it by calling getInstance instead of getDefaultInstance.
    However if that isn't the problem, how about spending a few seconds to post a less useless question?

  • Java.security.AccessControlException when calling web service from applet

    I have an applet that calls a webservce (Xmethods' delayed stock quote service). When I run the applet in appletviewer, I get the following:
    [SOAPException: faultCode=SOAP-ENV:Client; msg=Error opening socket: java.security.AccessControlException: access denied (java.net.SocketPermission 66.28.98.121:9090 connect,resolve); targetException=java.lang.IllegalArgumentException:
    Error opening socket: java.security.AccessControlException:
    access denied
    etc.....
    My code works fine as an application, but not as an applet. (This was after I eventually had to extract the necessary SOAP .jar files into the same directory as my applet, but that's another topic...or maybe not?)
    Help!
    Regards,
    John Kirksey                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    The default security settings does not give an applet to connect to any other server apart from the one from which it was downloaded. This is your problem. To mitigate that you have to change the security setting of the applet conatiner i.e the JVM in the browser.
    Ironluca

  • AccessControlException with Windows Vista

    I have Java-Applet running for several month and alot of customers are working well. Now I get a customer reply that it's not possible to log in. On my machine everything is working well, but the customer is using Windows Vista, which I don't have. The Java console shows the following error:
    java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkExit(Unknown Source)
    at java.lang.Runtime.exit(Unknown Source)
    at java.lang.System.exit(Unknown Source)
    Does Windows Vista have a different behaviour concerning the java security policies. Or is it necessary to change settings in Internet Explorer? Is it required to sign the applet? How can I solve this...

    If "Open" and "Open Containing Folder" in the right-click context menu in the Download Manager window are grayed then that means that the file is no longer in the original download location and they may have been removed by Anti-virus or cleanup software.
    It is possible that your anti-virus software is corrupting the downloaded files or otherwise interfering with downloading files by Firefox.
    See also "Disable virus scanning in Firefox preferences - Windows"
    * http://kb.mozillazine.org/Unable_to_save_or_download_files

  • Java.lang.Exception:java.security.accesscontrolException:access denied

    good afternoon to all experts
    i am getting the following exception when i am going to read file
    java.lang.Exception:java.security.accesscontrolException:accessdenied(java.io.FilePermission c:\premiji.rar)
    my applet as follows
    import java.io.*;
    import java.applet.*;
    import java.awt.*;
    import java.security.*;
    import javax.crypto.Cipher;
    import javax.crypto.KeyGenerator;
    import javax.crypto.SecretKey;
    import javax.crypto.spec.*;
    import java.io.IOException;
    public class TestApp extends Applet
         public static TextField t;
         public static String key;
        public Label l;
    public  void init()
       setBackground(Color.GRAY);
       setLayout(null);
       t=new TextField("  ");
       t.setEchoChar('*');
       l=new Label("Enter ur key");
       l.setBounds(0,2,75,20);
       t.setForeground(Color.RED);
       t.setBounds(78,2,150,20);
    add(l);
       add(t);
    public static String eFile(String plainFile)throws Exception
    {String cFile="c://suri.rar";
         key=t.getText();
        byte[]raw=key.getBytes("UTF8");
        SecretKeySpec skeySpec = new SecretKeySpec(raw, "Blowfish");
        Cipher cipher = Cipher.getInstance("Blowfish");
        Cipher cipher2=Cipher.getInstance("Blowfish");
        cipher2.init(Cipher.DECRYPT_MODE,skeySpec);
        cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
        InputStream fis,dis;
        FileOutputStream fos,dos;
        fis = new FileInputStream("c://premji.rar");
        fis = new javax.crypto.CipherInputStream(fis, cipher);
        fos = new FileOutputStream(cFile);
        byte[] b = new byte[8];
        int i = fis.read(b);
        while (i != -1) {
            fos.write(b, 0, i);
            i = fis.read(b);
    dis = new FileInputStream(cFile);
    dis = new javax.crypto.CipherInputStream(dis, cipher2);
    dos=new FileOutputStream("c://madhu.rar");
    byte[] c=new byte[8];
    int j=dis.read(c);
    while(j!=-1)
         dos.write(c,0,j);
         j=dis.read(c);
       fis.close() ;
       fos.close();
       return cFile;
    }my html as follows
    html>
    <script language="JavaScript">
      function pass()
        document.myForm.uname.value=document.myApp.eFile(document.myForm.upfile.value);
    </script>
    <applet name="myApp" code="TestApp.class" archive="TestApp.jar" width=600 height=80></applet>
    <body>
    <form name="myForm" >
    Name
    <input type="text" name="uname"/>
    File
    <input type="file" name="upfile"/>
    <input type=button value="click" onClick="pass();">
    <input type="submit"/>
    </form>
    </body>
    </html>note:
    i signed my applet like
    keytool -genkey -alias sgsits -validity 365
    jarsigner TestApp.jar sgsitshave we to modify polacy file also?
    if so how & which one modify
    any suggestion would be greatly appreciated
    thanks in advance

    I assume your signature is correct.
    Signing the applet enables privileges (like file IO) whenever all the calls on the stack leading
    to the sensitive operation (in your case fis = new FileInputStream("c://premji.rar")) originate
    from the signed jar. It is not your case, as you come into the applet from javascript.
    The solution is to use AccessController.doPrivileged...(). It was designed with this situation in mind.

  • AccessControlException with third party JCE provider

    Hi,
    I have a third party cryptographic provider that I must use.
    I can't tell if the provider is failing to load or if actual operations are denied. All I do know is that everytime it tries to actually do anything it fails with (the class that subclasses Provider is called IAIK):
    Caused by: java.security.AccessControlException: access denied (java.security.SecurityPermission putProviderProperty.IAIK)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
    at java.security.AccessController.checkPermission(AccessController.java:401)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
    at java.lang.SecurityManager.checkSecurityAccess(SecurityManager.java:1698)
    at java.security.Provider.check(Provider.java:341)
    at java.security.Provider.put(Provider.java:303)
    at iaik.security.provider.IAIK.a(Unknown Source)
    at iaik.security.provider.IAIK.<init>(Unknown Source)
    It seems to me that the provider is trying to programmatically load and register itself. Obviously I have to grant permission to do this, but I don't know how, because I don't know exactly what its trying to do.
    I did find something in the JDK docs mentioning doing something like this to the server.policy:
    grant codeBase "file:C:/Sun/AppServer7/domains/domain1/server1/lib/*" {
         permission java.security.SecurityPermission "putProviderProperty.IAIK"
    But this not only doesn't work, I also need to understand it.
    I've tried using it as a standard extension and it still doesn't work.
    Would appreciate any pointers here
    Thanks
    Sam

    Hi ,
    I am using SUN ONE application server and I have a third party cryptographic provider that I must use(BouncyCastleProvide). I've modified server.policy, java.policy files but nothing helped.
    // These permissions apply to the RD application
    grant codeBase "file:C:/Sun/AppServer7/domains/domain1/server1/lib/*" {
    permission java.security.AllPermission;
    Please help.
    Thanks
    INFO: CORE3282: stdout: [02/Mar/2005 14:22:08:866] error: |AESEncryption|prepareMap|1|oSecretKey_file: /WEB-INF/config
    /secret_asn1.key
    INFO: CORE3282: stdout: [02/Mar/2005 14:22:08:866] error: |AESEncryption|prepareMap|1|oGenrateKeys: no
    INFO: CORE3282: stdout: [02/Mar/2005 14:22:08:897] error: |AESEncryption|AESEncryption::Constructor|1|java.security.Ac
    cessControlException: access denied (java.security.SecurityPermission putProviderProperty.BC)
    INFO: CORE3282: stdout: at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
    INFO: CORE3282: stdout: at java.security.AccessController.checkPermission(AccessController.java:401)
    INFO: CORE3282: stdout: at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
    INFO: CORE3282: stdout: at java.lang.SecurityManager.checkSecurityAccess(SecurityManager.java:1698)
    INFO: CORE3282: stdout: at java.security.Provider.check(Provider.java:384)
    INFO: CORE3282: stdout: at java.security.Provider.put(Provider.java:339)
    INFO: CORE3282: stdout: at org.bouncycastle.jce.provider.BouncyCastleProvider.<init>(BouncyCastleProvider.java:52)
    INFO: CORE3282: stdout: at com.sp.fwk.golden.encryption.AESEncryption.<init>(AESEncryption.java:48)
    INFO: CORE3282: stdout: at com.sp.fwk.golden.encryption.AESEncryption.getInstance(AESEncryption.java:71)
    INFO: CORE3282: stdout: at com.sp.fwk.golden.presentation.FwkServlet.init(FwkServlet.java:72)
    INFO: CORE3282: stdout: at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    INFO: CORE3282: stdout: at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:921)
    INFO: CORE3282: stdout: at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:658)
    INFO: CORE3282: stdout: at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:229)
    INFO: CORE3282: stdout: at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    INFO: CORE3282: stdout: at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    INFO: CORE3282: stdout: at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    INFO: CORE3282: stdout: at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
    INFO: CORE3282: stdout: at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    INFO: CORE3282: stdout: at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
    INFO: CORE3282: stdout: at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)

  • Java.security.AccessControlException in a RMI application

    Hello,
    I have the following error, while I'm launching my RMI application :
    access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
    java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
    at java.security.AccessController.checkPermission(AccessController.java:399)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
    at java.lang.SecurityManager.checkConnect(SecurityManager.java:1044)
    at java.net.Socket.<init>(Socket.java:262)
    I was trying the following instruction :
    if (System.getSecurityManager() == null)
    System.setSecurityManager(new RMISecurityManager());
    try{
    Recepteur obj = new Recepteur();
    Naming.rebind("//localhost/Recepteur", obj);
    However, I have written in the java.policy file :
    grant codeBase "http://127.0.0.1:1099/-" {
         permission java.security.AllPermission;
    Does anyone know how to solve this problem ?
    Thx

    Help him please or he would be obliged to give me the dukes...

  • Signed applet not working in firefox - java.security.AccessControlException

    Hello,
    I have a signed applet that works fine in IE 7 but in Firefox I'm getting this exception in the java console:
    java.security.AccessControlException: access denied (java.net.SocketPermission myhost.com resolve)
    I already tried to run the applet with different JRE versions in Firefox with the same result: 1.6.0_01, 1.6.0_02, 1.6.0_03, 1.6.0_05
    I'll appreciate your help.

    thanx 4 replying
    using the browser to view Applet is not recomended that is because if u change the the source-code and recompile the applet then run it using the broswer it will run the old-version
    Also i've found the solution here
    http://www.cs.utah.edu/classes/cs1021/notes/lecture03/eclipse_help.html

  • Java.security.AccessControlException: access denied (java.util.PropertyPerm

    Hi All,
    I try to run an applet from Solaris 8 server on some client machine using IE5 and NetScape 6.2 ( I installed JRE 1.4, I also try other JRE versions) but I get the following errors again and agian,
    I even try to use appletviewer on the Solaris Box itself to open the applet but it makes no difference same errors
    could somebody please help or give me a hint how should I start tracing what the problem might be ?
    this applet comes with Solaris Bandwidth Manager as a gui administration tool ( webbased ) it supposed to change the configurations remotly over the web. I asure there is no solaris permission problem exist.
    I use Tomcat on the server side.Installed JDK 1.3 on Solaris 8 with all the default settings.
    i suppose something should be done with java.policy or java.security files i know nothing about java security please at least give me some URL's to find out more about this matter i searched a lot but couldn't find good documents about java default security restrictions
    java.lang.ExceptionInInitializerError
    at com.sun.ba.common.QConfiguration.loadPredefServices(QConfiguration.java:617)
    at com.sun.ba.common.QConfiguration.getPredefServices(QConfiguration.java:630)
    at com.sun.ba.tool.MainPanel.<init>(MainPanel.java:95)
    at com.sun.ba.tool.QoSFrame.<init>(QoSFrame.java:48)
    at com.sun.ba.tool.baApplet.init(baApplet.java:46)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission console read)
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
    at java.lang.System.getProperty(Unknown Source)
    at com.sun.ba.common.QDebug.<clinit>(QDebug.java:39)
    ... 7 more
    any help would be appriciated so much.
    thanks
    mehmad

    I dont know, but It may be that an Applet can only access the local machine. ie. If you run the applet on computer A and you want to edit the config on computer B, I do not believe you can. The applet can only talk to Computer A. You would have to:
    1) Run an application on computer A and the applet would tell the application what to change.
    2)Maybe sign the applet in a JAR File
    You will probably have to do #1.
    US101

  • Java.security.AccessControlException: access denied (java.util.PropertyPer

    Hi All,
    I try to run an applet from Solaris 8 server on some client machine using IE5 and NetScape 6.2 ( I installed JRE 1.4, I also try other JRE versions) but I get the following errors again and agian,
    I even try to use appletviewer on the Solaris Box itself to open the applet but it makes no difference same errors
    could somebody please help or give me a hint how should I start tracing what the problem might be ?
    this applet comes with Solaris Bandwidth Manager as a gui administration tool ( webbased ) it supposed to change the configurations remotly over the web. I asure there is no solaris permission problem exist.
    I use Tomcat on the server side.Installed JDK 1.3 on Solaris 8 with all the default settings.
    i suppose something should be done with java.policy or java.security files i know nothing about java security please at least give me some URL's to find out more about this matter i searched a lot but couldn't find good documents about java default security restrictions
    java.lang.ExceptionInInitializerError
         at com.sun.ba.common.QConfiguration.loadPredefServices(QConfiguration.java:617)
         at com.sun.ba.common.QConfiguration.getPredefServices(QConfiguration.java:630)
         at com.sun.ba.tool.MainPanel.<init>(MainPanel.java:95)
         at com.sun.ba.tool.QoSFrame.<init>(QoSFrame.java:48)
         at com.sun.ba.tool.baApplet.init(baApplet.java:46)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission console read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         at com.sun.ba.common.QDebug.<clinit>(QDebug.java:39)
         ... 7 more
    any help would be appriciated so much.
    thanks
    mehmad

    Hi,
    Please make changes in the java.security files present in the jdk1.3/lib/jre/security/java.security.There you make the changes in the property which gives you the error.See if this helps..
    regards vickyk

  • Java.security..AccesscontrolException: access denied (java.util.PropertyP..

    I am trying to access the Cisco PIX device manager to get access to my firewall, but get the error message above when trying to start the applet: Is this a bug? Thankful for any input! See the Java concole output below:
    Java Plug-in 1.5.0_06
    Using JRE version 1.5.0_06 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\Kari
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    p: reload proxy configuration
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    Requesting URL: https://10.1.1.1/jploader.jar
    java.security.AccessControlException: access denied (java.util.PropertyPermission java.version read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         at com.cisco.pdm.e.c.q(Unknown Source)
         at com.cisco.pdm.e.c.h(Unknown Source)
         at com.cisco.pdm.a.byte(Unknown Source)
         at com.cisco.pdm.PDMApplet.start(Unknown Source)
         at com.cisco.nm.util.sgz.Env.start(Env.java:37)
         at com.cisco.nm.util.sgz.Loader.start(Loader.java:109)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)

    I had the same problem trying to open a Pix 506e through Internet Explorer.
    After downloading and installing and uninstalling again differt versions; the working solution for me was version JRE 1.4.2_07
    Be sure to download the 07, other versions of the 1.4.2 were not working!

  • AccessControlException when run in IE or Safari, but not Applet Viewer

    My applet requires the use of a txt file as input. The txt file need only be read, and is always in the same directory as the class files and the web page the applet's running in. For a while now, there have been no problems with reading the txt file; however, recently, I've been getting a "java.security.AccessControlException: access denied (java.io.FilePermission *insert filename here* read)" error. Furthermore, this error only comes up when I run the applet in Internet Explorer or Safari; when I run it in the applet viewer, it works perfectly. On top of this, when I went to the tutorial suspecting that the problem had something to do with thread management, I noticed that all three of the applets on page http://java.sun.com/docs/books/tutorial/essential/threads/index.html of the tutorial generated errors, which may or may not indicate that the problem lies in my browsers; frankly, I'm not sure. Any help that you people can give me would be greatly appreciated!

    Applets can not read from the filesystem unless you set up policy or sign the applet (or both)
    http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
    second post
    If you applet needs to read a file that is in the same location as the html file and applet why not use the
    URL object?

Maybe you are looking for

  • White MacBook (Early 2008 Model) The Case is Peeling Away!

    Good morning all. I've had this issue for a few months where my MacBook's casing is peeling away at the edges, and it all seems to be near the magnets. I have one on the upper right hand corner of the screen (again, on the edge, which is slowly makin

  • List View Printing Problem

    Greetings, I'm using iCal 2.0.3 on OS X 10.4.3. I'm having two problems making a "List View" print look correct. Problem #1: I have a To Do item that was due several days ago. It shows up in the main iCal To Do pane with an attention icon next to it

  • Thunar custom actions for devices?

    Hi! As you might know it's possible in Thunar to add custom actions to the context menu of files/folders/... but is it also possible to add custom actions to devices like flash drives or partitions? My problem is: I got a few encrypted partitions whi

  • Why can't i install my 5 yr. old hp photosmart 2575 to my new hp pavillion. is this is software iss

    Why can't I install my 5 yr old HP Photosmart software on my new HP pavillion? I get an error message saying can't install on this operating system. ie,: win. XP.

  • IMac Freezes and then doesn't startup

    I have a 600Mhz G3 iMac, and from some time ago, it is giving some problems. At first, it freezes and when restarting, after the normal chime a blinking "?" folder appeared. I'm a old Mac user (15 years)...and i know that is a "No System to startup"