Java.security.AccessControlException using AccessController.doPrivileged
Hi all,
i'm working with a signed applet in which i need to load a dll. I know that accessing a local dll is not so simple, but as i've read around on the net it should be possible using the AccessController.doPrivileged method to get permissions on a block of code. Even if it is not so safe.
But i'm still getting following exception
- Exception
java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.C:\Program Files\....\dllname.dll)
even if the dll access is done inside a privileged block of code as follows
WebBrowser browser = (WebBrowser) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
Xpcom.initialize();
browser = WebBrowserFactory.getInstance().createBrowser();
browser.navigate(url);
return browser;
});I didn't change anything else (java.policy file for example).
Am i missing something? Shouldn't the privileged block let me avoid AccessControlException? (Please note that i get the same exception with or without the privileged block).
Thank you very much for your help.
Edited by: notsokevin on Aug 21, 2009 6:44 AM
Hi,
adding the following permissions in the policy file helped:
grant {
// following two permissions allow
// access to default config files
permission java.io.FilePermission
"/path/to/mail.jar", "read";
permission java.io.FilePermission
"/path/to/activation.jar", "read";
// following to use SMTP
permission java.net.SocketPermission
"SMTPHOST:25", "connect,resolve";
// following needed if System.getProperties() is used
permission java.util.PropertyPermission
"*", "read,write";
Thank you.
- cheers
Sakthi
Similar Messages
-
Hi !
WLS version: 5.1 with SP10
Server OS: NT4
Client distr.: Java WebStart
Client OS: Windows 2000
I get the following exception when I try to create a T3 connection
(tunnelled through HTTP) to my WLS server:
java.security.AccessControlException: access denied
(java.util.PropertyPermission proxyHost 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 weblogic.net.http.HttpClient.resetProperties(HttpClient.java:62)
at weblogic.net.http.HttpClient.openServer(HttpClient.java:186)
at weblogic.net.http.HttpClient.<init>(HttpClient.java:85)
at weblogic.net.http.HttpClient.New(HttpClient.java:117)
at weblogic.net.http.HttpURLConnection.connect(HttpURLConnection.java:97)
at
weblogic.net.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1
44)
at weblogic.socket.JVMSocketHTTPClient.sendMsg(JVMSocketHTTPClient.java:260)
at weblogic.socket.JVMAbbrevSocket.sendOutMsg(JVMAbbrevSocket.java:348)
at weblogic.socket.JVMAbbrevSocket.sendMsg(JVMAbbrevSocket.java:237)
at weblogic.rjvm.ConnectionManager.sendMsg(ConnectionManager.java:420)
at weblogic.rjvm.RJVMImpl.send(RJVMImpl.java:564)
at
weblogic.rjvm.MsgAbbrevOutputStream.flushAndSendRaw(MsgAbbrevOutputStream.ja
va:155)
at
weblogic.rjvm.MsgAbbrevOutputStream.flushAndSend(MsgAbbrevOutputStream.java:
163)
at
weblogic.rjvm.MsgAbbrevOutputStream.sendRecv(MsgAbbrevOutputStream.java:186)
at
weblogic.rmi.internal.BasicOutgoingRequest.sendRecv(BasicOutgoingRequest.jav
a:23)
at
weblogic.rmi.extensions.AbstractRequest.sendReceive(AbstractRequest.java:73)
at
com.unitor.message.server.UserInformationServiceBeanHomeImpl_WLStub.create(U
serInformationServiceBeanHomeImpl_WLStub.java:151)
at
com.unitor.message.server.UserInformationServiceBeanHomeImpl_ServiceStub.cre
ate(UserInformationServiceBeanHomeImpl_ServiceStub.java:121)
at
com.unitor.message.beans.gui.MessageLogic.getUserInformationService(MessageL
ogic.java:230)
at
com.unitor.message.beans.gui.MessageLogic.addUserInformation(MessageLogic.ja
va:186)
at com.unitor.message.beans.gui.MessageLogic.<init>(MessageLogic.java:104)
at
com.unitor.message.beans.gui.MessageApplication.internalStartApplication(Mes
sageApplication.java:64)
at
com.unitor.ifs.util.gui.UnitorApplication.startApplication(UnitorApplication
.java:167)
at
com.unitor.ifs.util.gui.DesktopApplication$ApplicationLoader.run(DesktopAppl
ication.java:676)
at
com.unitor.ifs.util.gui.DesktopApplication.startApplication(DesktopApplicati
on.java:303)
at
com.unitor.ifs.util.gui.UnitorDesktopAppStarter$SwingEventCall.run(UnitorDes
ktopAppStarter.java:294)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
The strange thing is that I can connect to my server if I run the client on
NT4 !!!
I solved the problem by modifying my local java.policy file with the
following settings:
// Test with HTTP tunnelling. 18.10.2001
[email protected]
permission java.util.PropertyPermission "proxyHost", "read";
permission java.util.PropertyPermission "proxyPort", "read";
permission java.util.PropertyPermission "http.proxyHost", "read";
permission java.util.PropertyPermission "http.proxyPort", "read";
permission java.net.SocketPermission "*","connect,resolve";
// Test with HTTP tunnelling. 18.10.2001
[email protected]
Have someone else experienced the same or similar problems ?
How can I make sure that the client gets access to read the properties
http.proxyHost, http.proxyPort, proxyHost and proxyPort without telling the
users of the client application to modify their java.policy files ?
Any leads will be greatly appreciated !
Regards
Sten RichardThis is in reply to the first post. I don't know what happened after.
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission sun.arch.data.model 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 org.eclipse.swt.internal.Library.loadLibrary(Library.java:167)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:151)
at org.eclipse.swt.internal.C.<clinit>(C.java:21)
If you read the above trace from bottom to top, it shows none of you classes, only classes from that Eclipse library, which seems to loadLibrary() a native DLL. In order to do this, it needs to call System.getProperty( "sun.arch.data.model" ). This call is not allowed from un unsigned applet. So I guess you need to sign the applet and this problem will go away. Many other problems may follow. Just read very very carefully all the related documentation, which I did not. -
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 advanceI 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. -
Till morning everything working fine in my applet. I took Java update and everything stopped. I'm dealing with digital certificate using applet. Here is my stack trace. I followed some oracle article but didn't work.
https://blogs.oracle.com/java-platform-group/entry/liveconnect_changes_in_7u45
JAR File Manifest Attributes for Security
http://www.oracle.com/technetwork/java/javase/7u45-relnotes-2016950.html
Java Plug-in 10.45.2.18
Using JRE version 1.7.0_45-b18 Java HotSpot(TM) Client VM
User home directory = C:\Users\vicky.thakor
java.security.AccessControlException: access denied ("java.security.SecurityPermission" "authProvider.SunMSCAPI")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkPermission(Unknown Source)
at sun.security.mscapi.KeyStore.engineLoad(KeyStore.java:755)
at sun.security.mscapi.KeyStore$MY.engineLoad(KeyStore.java:62)
at java.security.KeyStore.load(Unknown Source)
at SecurityApplet.initializeBrowserKeyStore(SecurityApplet.java:162)
at SecurityApplet.isCertificateInstalled(SecurityApplet.java:268)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.Trampoline.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass$MethodInfo.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass$MemberBundle.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass.invoke0(Unknown Source)
at sun.plugin2.liveconnect.JavaClass.invoke(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$DefaultInvocationDelegate.invoke(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo.doObjectOp(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$LiveConnectWorker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I'm creating .java.policy file in public void init() method of applet. Its before accessing anything in applet. But its not working. Here is my .java.policy file.
grant
permission java.security.AllPermission;
permission java.io.FilePermission "<<ALL FILES>>", "read";
permission java.io.FilePermission "<<ALL FILES>>", "write";
permission java.util.PropertyPermission "*", "read, write";
permission java.util.PropertyPermission "user.home", "read";
permission java.util.PropertyPermission "user.dir", "read";
permission java.lang.RuntimePermission "modifyThread";
permission java.lang.RuntimePermission "*";
This is solved by changing java.policy file at C:\Program Files (x86)\Java\jre7\lib\security. I did it manually but our application running all around the world. And I can't go to each user to change the java.policy file. And also some user don't have admin access to change that file. So is there any way we can set runtime parameter(s) or something else... I already posted this question in stackoverflow but couldn't find the way out. I also created MANIFEST.MF file but still not working.
Stackoverflow link: oracle - java.security.AccessControlException: access denied (&quot;java.security.SecurityPermission&quot; &…Till morning everything working fine in my applet. I took Java update and everything stopped. I'm dealing with digital certificate using applet. Here is my stack trace. I followed some oracle article but didn't work.
https://blogs.oracle.com/java-platform-group/entry/liveconnect_changes_in_7u45
JAR File Manifest Attributes for Security
http://www.oracle.com/technetwork/java/javase/7u45-relnotes-2016950.html
Java Plug-in 10.45.2.18
Using JRE version 1.7.0_45-b18 Java HotSpot(TM) Client VM
User home directory = C:\Users\vicky.thakor
java.security.AccessControlException: access denied ("java.security.SecurityPermission" "authProvider.SunMSCAPI")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkPermission(Unknown Source)
at sun.security.mscapi.KeyStore.engineLoad(KeyStore.java:755)
at sun.security.mscapi.KeyStore$MY.engineLoad(KeyStore.java:62)
at java.security.KeyStore.load(Unknown Source)
at SecurityApplet.initializeBrowserKeyStore(SecurityApplet.java:162)
at SecurityApplet.isCertificateInstalled(SecurityApplet.java:268)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.Trampoline.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass$MethodInfo.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass$MemberBundle.invoke(Unknown Source)
at sun.plugin2.liveconnect.JavaClass.invoke0(Unknown Source)
at sun.plugin2.liveconnect.JavaClass.invoke(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$DefaultInvocationDelegate.invoke(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo.doObjectOp(Unknown Source)
at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$LiveConnectWorker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I'm creating .java.policy file in public void init() method of applet. Its before accessing anything in applet. But its not working. Here is my .java.policy file.
grant
permission java.security.AllPermission;
permission java.io.FilePermission "<<ALL FILES>>", "read";
permission java.io.FilePermission "<<ALL FILES>>", "write";
permission java.util.PropertyPermission "*", "read, write";
permission java.util.PropertyPermission "user.home", "read";
permission java.util.PropertyPermission "user.dir", "read";
permission java.lang.RuntimePermission "modifyThread";
permission java.lang.RuntimePermission "*";
This is solved by changing java.policy file at C:\Program Files (x86)\Java\jre7\lib\security. I did it manually but our application running all around the world. And I can't go to each user to change the java.policy file. And also some user don't have admin access to change that file. So is there any way we can set runtime parameter(s) or something else... I already posted this question in stackoverflow but couldn't find the way out. I also created MANIFEST.MF file but still not working.
Stackoverflow link: oracle - java.security.AccessControlException: access denied (&quot;java.security.SecurityPermission&quot; &… -
Getting java.security.AccessControlException: access denied
My application is applet based. In this when i trying to read one image file from my drive folder it is giving
java.security.AccessControlException: access denied
i tried AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
// perform the security-sensitive operation here
but this is also not helping..
What i m suppossing is that applet will not allow to acess Client machine
then how i 'll get that image file from from my machine folder....
I want to use this image file set as windows icon..
or is there any other method to set the icon of the window
Edited by: Sandy10 on Mar 17, 2010 10:27 AM
Edited by: Sandy10 on Mar 17, 2010 12:06 PMHow does this differ from your [other question|http://forums.sun.com/thread.jspa?threadID=5432244]?
-
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
mehmadI 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 -
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
mehmadHi,
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 -
I am upgrading an old NB4.1 produced JSP system that runs on Netscape iplanet to NB7.0.1 built JSP system running on Glassfish 3.1.1. I have four main files: login.html, login.jsp, ApplicationRmiConnection, and MenuManager.jsp . Three of four are working. The login.html is only a startup means to be sent to the login.jsp. The ApplicationRmiConnection is a servlet called by the login.jsp. It reads a properties file, establishes connection with the RMI and database (currently on the OLD system (Netscape iplanet)) which it does quite well. After the ApplicationRmiConnection is established and working the MenuManager.jsp . The first output from the MenuManager.jsp is a series of application.log calls for verification of data passed in from the successful ApplicationRmiConnection database read.
How does GF 3.1.1 loose AccessControl permissions to the server.log to which it is writing? All I am using is application.log statements and it coughs, chokes, and quits.
My output stacktrace is:
INFO: PWC1412: WebModule[null] ServletContext.log():ApplicationRmiConnect: getRealPath("/") = [C:\Program Files\glassfish\glassfish-3.1\glassfish\domains\domain1\applications\MyApplication\]
INFO: PWC1412: WebModule[null] ServletContext.log():MenuMgr: sParms - RMI Connect = com.company.rmi.ServerAppClientAdapter@19ca6bc
INFO: PWC1412: WebModule[null] ServletContext.log():MenuMgr: caught an Exception
WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.security.AccessControlException: access denied (java.io.FilePermission C:\Program Files\glassfish\glassfish-3.1\glassfish\domains\domain1\logs\server.log read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
at java.io.File.exists(File.java:731)
at com.sun.enterprise.server.logging.GFFileHandler.publish(GFFileHandler.java:676)
at java.util.logging.Logger.log(Logger.java:481)
at com.sun.logging.LogDomains$1.log(LogDomains.java:354)
at java.util.logging.Logger.doLog(Logger.java:503)
at java.util.logging.Logger.logp(Logger.java:619)
at com.sun.enterprise.web.logger.IASLogger.write(IASLogger.java:127)
at com.sun.enterprise.web.logger.LoggerBase.log(LoggerBase.java:190)
at com.sun.enterprise.web.logger.IASLogger.log(IASLogger.java:57)
at org.apache.catalina.core.StandardContext.log(StandardContext.java:6828)
at org.apache.catalina.core.ApplicationContext.log(ApplicationContext.java:449)
at org.apache.catalina.core.ApplicationContextFacade.log(ApplicationContextFacade.java:359)
at org.apache.jsp.MenuMgr_jsp._jspService(MenuMgr_jsp.java from :533)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)The problem area has been found. We need to know the best method to replace the two lines of code we commented out. Here is what we found.
Glassfish 3.1.1 Security does not play well with old RMI security (JDK1.2 vintage). Furthermore, once the old RMI security has messed with the mind of GF3.1.1 security the GF security truly believes it has in some cases no permission to read its own server.log file.
Here is the offending code commented out in the Server Client Adapter (client wrapper):
Note: this is legacy rmi code. i.e. manually executed rmic on the appropriate classfiles as this was originally created for java 1.2.
// if(System.getSecurityManager() == null)
// System.setSecurityManager(new RMISecurityManager());
remote = (com.davisco.rmi.ServerAppServantAdapter_Stub)Naming.lookup(stringbuffer.toString());
A thank you goes out to www.velocityreviews.com/forums/t276590-access-denied-java-lang-runtimepermission-createsecuritymanager.html even if it is five years old.
Again, this is using the original version of RMI. How do we re-implement the RMI Security Manager without offending GF 3.1.1 security? -
We are in the process of migrating from Weblogic 6.1 SP2 to SP5. We have an applet
that
subscribes to a JMS Topic. The applet is throwing the following exception with
SP5:
java.lang.ExceptionInInitializerError: java.security.AccessControlException: access
denied
(java.util.PropertyPermission weblogic.kernel.allowQueueThrottling 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 weblogic.kernel.Kernel.initAllowThrottleProp(Kernel.java:79)
at weblogic.kernel.Kernel.<clinit>(Kernel.java:54)
at weblogic.jndi.WLInitialContextFactoryDelegate.<init>(WLInitialContextFactoryDelegate.java:166)
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Unknown Source)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:147)
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 com.fedex.efm.frontend.model.JMSMessageProcessor.<init>(JMSMessageProcessor.java:266)
at com.fedex.efm.frontend.view.EFMAbstractApplet.startMessageProcessor(EFMAbstractApplet.java:81)
at com.fedex.efm.frontend.view.EFMAbstractApplet.start(EFMAbstractApplet.java:187)
at com.fedex.efm.frontend.view.EFMApplet.start(EFMApplet.java:430)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Any ideas as to what I am missing?
Thanks,
RamPrasad,
It's one thing not to have to modify the security policy on the server,
but on a client and applets have even bigger restrictions this might
very well be the only way since the default applet restrictions would
not allow a lot of permissions granted by default for normal Java
applications.
Dejan
Prasad Peddada wrote:
Deyan D. Bektchiev wrote:
Ram,
You are missing a permission grant in your policy file and the
SecurityManager doesn't allow the code to read that property.
You have either configured a different security manager or have the
wrong file in use.
For applets this file might be in the user's home directory and named
.java.policy
you need to have the following line somethere in it:
grant {
permission java.util.PropertyPermission "*", "read,write";
Which will allow any applet to read and write any JVM property.
Look at Java permissions is you need more info:
http://java.sun.com/j2se/1.3/docs/guide/security/permissions.html
--dejan
Ram Gopal wrote:
We are in the process of migrating from Weblogic 6.1 SP2 to SP5. We
have an applet
that
subscribes to a JMS Topic. The applet is throwing the following
exception with
SP5:
java.lang.ExceptionInInitializerError:
java.security.AccessControlException: access
denied
(java.util.PropertyPermission weblogic.kernel.allowQueueThrottling
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
weblogic.kernel.Kernel.initAllowThrottleProp(Kernel.java:79) at
weblogic.kernel.Kernel.<clinit>(Kernel.java:54) at
weblogic.jndi.WLInitialContextFactoryDelegate.<init>(WLInitialContextFactoryDelegate.java:166)
at java.lang.Class.newInstance0(Native Method) at
java.lang.Class.newInstance(Unknown Source) at
weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:147)
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
com.fedex.efm.frontend.model.JMSMessageProcessor.<init>(JMSMessageProcessor.java:266)
at
com.fedex.efm.frontend.view.EFMAbstractApplet.startMessageProcessor(EFMAbstractApplet.java:81)
at
com.fedex.efm.frontend.view.EFMAbstractApplet.start(EFMAbstractApplet.java:187)
at com.fedex.efm.frontend.view.EFMApplet.start(EFMApplet.java:430)
at sun.applet.AppletPanel.run(Unknown Source) at
java.lang.Thread.run(Unknown Source)
Any ideas as to what I am missing?
Thanks,
Ram
This is a WLS bug. You shouldn't have to modify security policy.
Please approach support for a fix.
Cheers,
-- Prasad -
Java.security.AccessControlException: access denied
Hi all
While deploying my portal application lots of following exceptions are thrown. Please guide me how I can solve this issue
<Aug 16, 2007 12:27:43 PM PKT> <Warning> <Management> <BEA-400409> <Exception fr
om ApplicationFilePoller while checking for changes in application appsdirDteP
ortal_dir, directory GHQPortal.
java.security.AccessControlException: access denied (java.io.FilePermission D:\b
ea\user_projects\domains\portalDomain\applications\DtePortal\GHQPortal read)
at java.security.AccessControlContext.checkPermission(Ljava.security.Per
mission;)V(AccessControlContext.java:269)
at java.security.AccessController.checkPermission(Ljava.security.Permiss
ion;)V(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(Ljava.security.Permission;)
V(Unknown Source)
at java.lang.SecurityManager.checkRead(Ljava.lang.String;)V(Unknown Sour
ce)
at java.io.File.list()[Ljava.lang.String;(Unknown Source)
at java.io.File.list(Ljava.io.FilenameFilter;)[Ljava.lang.String;(Unknow
n Source)
at com.bea.p13n.management.ApplicationFilePoller.searchDirs(Ljava.lang.S
tring;Ljava.util.Map;)V(ApplicationFilePoller.java:719)
at com.bea.p13n.management.ApplicationFilePoller.searchDirs()Ljava.util.
Map;(ApplicationFilePoller.java:708)
at com.bea.p13n.management.ApplicationFilePoller.check()V(ApplicationFil
ePoller.java:671)
at com.bea.p13n.management.ApplicationFilePoller.access$200(Lcom.bea.p13
n.management.ApplicationFilePoller;)V(ApplicationFilePoller.java:145)
at com.bea.p13n.management.ApplicationFilePoller$PollerThread.checkAllPo
llers()V(ApplicationFilePoller.java:997)
at com.bea.p13n.management.ApplicationFilePoller$PollerThread.run()V(App
licationFilePoller.java:953)
at java.lang.Thread.run()V(Unknown Source)
at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Sourc
e)
ThanksHi
Thanks for reply bposner. I am using 'weblogic' user to deploy the application. Please help me to dig out this problem.
This problem seems linked with Java Security manager. How can I disable Java Security Manager or what permission should I add in security file to resolve this problem.
Thanks
Edited by arafique393 at 08/16/2007 11:23 PM
Edited by arafique393 at 08/17/2007 4:47 AM -
Java.security.AccessControlException
java.security.AccessControlException: access denied (java.io.FilePermission C:\Sun\AppServer\domains\domain1\applications\j2ee-modules\fileserver2\ind\_1.fnm delete)
java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)
java.security.AccessController.checkPermission(AccessController.java:401)
java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
java.lang.SecurityManager.checkDelete(SecurityManager.java:982)
java.io.File.delete(File.java:847)
org.apache.lucene.store.FSDirectory.deleteFile(FSDirectory.java:197)
org.apache.lucene.index.SegmentMerger.createCompoundFile(SegmentMerger.java:157)
org.apache.lucene.index.SegmentMerger.merge(SegmentMerger.java:100)
org.apache.lucene.index.IndexWriter.mergeSegments(IndexWriter.java:487)
org.apache.lucene.index.IndexWriter.flushRamSegments(IndexWriter.java:440)
org.apache.lucene.index.IndexWriter.close(IndexWriter.java:242)
indexer.IndexTWE.close(IndexTWE.java:127)
indexer.IndexTWE.createIndex(IndexTWE.java:118)
indexer.IndexTWE.run(IndexTWE.java:167)
index.IndexServlet.doPost(IndexServlet.java:83)
javax.servlet.http.HttpServlet.service(HttpServlet.java:768)
javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:289)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:311)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:205)May be you have to modify your <install>/domains/domain1/config/server.policy file...
-
Java.security.AccessControlException: access denied ( CredentialAccessPermi
Hello,
I am using JDev 11g TP4 for WCS (web center). I just created an application using WebCenter template and added a new page with only Output text. I tried to run it, I got the following error:
SEVERE: Server start failed processing configuration
java.security.AccessControlException: access denied ( CredentialAccessPermission credstoressp.credstore.default.systemuser read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at oracle.security.jps.util.JpsAuth$AuthorizationMechanism$3.checkPermission(JpsAuth.java:256)
at oracle.security.jps.util.JpsAuth$Diagnostic.checkPermission(JpsAuth.java:180)
at oracle.security.jps.util.JpsAuth$AuthorizationMechanism$6.checkPermission(JpsAuth.java:280)
at oracle.security.jps.util.JpsAuth.checkPermission(JpsAuth.java:315)
at oracle.security.jps.util.JpsAuth.checkPermission(JpsAuth.java:338)
at oracle.security.jps.internal.credstore.util.CsfUtil.checkPermission(CsfUtil.java:527)
at oracle.security.jps.internal.credstore.ssp.SspCredentialStore.getCredential(SspCredentialStore.java:420)
at oracle.security.jps.fmw.util.JpsFmwUtil.makeJpsSystemUser(JpsFmwUtil.java:221)
at oracle.security.jps.fmw.JpsUserManager.initSystemUser(JpsUserManager.java:270)
at oracle.security.jps.fmw.JpsUserManager.init(JpsUserManager.java:238)
at oracle.security.jps.fmw.JpsUserManager.<init>(JpsUserManager.java:250)
at oracle.security.jps.fmw.JpsUserManagerFactory$JpsUserManagerFactoryI.create(JpsUserManagerFactory.java:257)
at com.evermind.server.deployment.UserManagerConfig$JAZN.construct(UserManagerConfig.java:635)
at com.evermind.server.deployment.UserManagerConfig.delegatee(UserManagerConfig.java:253)
at com.evermind.security.IndirectUserManager.getAdminUser(IndirectUserManager.java:126)
at com.evermind.security.IndirectUserManager.getAdminUser(IndirectUserManager.java:126)
at com.evermind.server.XMLApplicationServerConfig.setPassword(XMLApplicationServerConfig.java:3170)
at com.evermind.server.XMLApplicationServerConfig.<init>(XMLApplicationServerConfig.java:246)
at com.evermind.server.ApplicationServer.createConfig(ApplicationServer.java:661)
at oracle.oc4j.server.ServerFactory$Worker.prepareConfig(ApplicationServerFactory.java:225)
at oracle.oc4j.server.ServerFactory$Worker.start(ApplicationServerFactory.java:244)
at oracle.oc4j.server.ServerFactory$Worker.run(ApplicationServerFactory.java:259)
at java.lang.Thread.run(Thread.java:595)
Jun 2, 2008 2:35:36 PM oracle.oc4j.util.SystemLog logNoStack
SEVERE: Server exiting: ApplicationServer entered state FAILED_IN_CONFIG
Anybody has experienced this before? Workaround?
Thanks.I think I figured this out. Since I installed the TP4, I used this for developing other apps without WC enabled. I noticed that when I started JDev for the first time, it creates the embedded server (?) in a directory you specified in JDEV_USER_DIR env var automatically. When I changed my TP4 to use WC, the required libraries, etc. were not copied or built for WC. I think this caused the problem I had. By closing JDev and deleting the created embedded server and restarting JDev, it solved my problem.
For TP4, the server directory looks like:
system11.1.1.0.22.49.49
I hope this will be useful for others that experience the same problem that I had. -
Hi, I am receiving the following error when I attempt to add a crypto provider.
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.security.jca.ProviderConfig$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.jca.ProviderConfig.doLoadProvider(Unknown Source)
at sun.security.jca.ProviderConfig.getProvider(Unknown Source)
at sun.security.jca.ProviderList.loadAll(Unknown Source)
at sun.security.jca.ProviderList.removeInvalid(Unknown Source)
at sun.security.jca.Providers.getFullProviderList(Unknown Source)
at java.security.Security.removeProvider(Unknown Source)
at com.gro.applet.GROAuthenticateApplet$2.run(GROAuthenticateApplet.java:192)
at java.security.AccessController.doPrivileged(Native Method)
at com.gro.applet.GROAuthenticateApplet.validateUser(GROAuthenticateApplet.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSInvoke.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.sunmscapi)
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.checkLink(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at sun.security.mscapi.SunMSCAPI$1.run(SunMSCAPI.java:34)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.mscapi.SunMSCAPI.<clinit>(SunMSCAPI.java:32)
... 32 more
java.lang.Exception: java.lang.ExceptionInInitializerError
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)I read somewhere that it is "Due to an additional dll that needs to be loaded for the Sun Java SE 6 JVM we get an exception during initialization"
Does anyone have any other information on this bug?I have just bumped into this with a Webstart application.
It seems to happen only on certain machines.
Is there a solution to this problem? -
Java.security.AccessControlException when accessing user documents
Hello there,
I'm a student programmer. I'm trying to write a desktop application which will read all of the user's documents folder and add it to a ZIP file. I am coding on Windows Vista but my code should be platform independent.
The problem I have is that whenever I try to access the user documents, I get a java.security.AccessControlException. The code I'm using follows:
//Find out the user's "My Documents" folder
javax.swing.JFileChooser fr = new javax.swing.JFileChooser();
javax.swing.filechooser.FileSystemView fw=fr.getFileSystemView();
//Zip the contents of "My Documents" to the current working directory
zip(fw.getDefaultDirectory().toString() + "\\", "JemsFrom.zip")
//Checking for permissions for reading source
FilePermission perm = new FilePermission(source, "read");
AccessController.checkPermission(perm);I Googled and apparently I need to add a policy file allowing my program access to the documents folder. I created the following policy file:
grant {
permission java.io.FilePermission "C:\\Users\\keith\\Documents", "read";
};I saved this file as 'perms' and then added the following to Netbeans' Argument list for this project:
-Djava.security.manager -Djava.security.policy=permsHowever, I am still getting this error and am totally stumped. I've also tried running this project outside Netbeans with those arguments but I get the same result.
Would greatly appreciate any help.I have changed my permissions file as david_david suggested, but I am still having the same problem... AccessControlException
Any other helpful suggestions would be welcome. -
Hi,
I have written swing code using applets.The code is::
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class JButtonDemo extends JApplet implements ActionListener{
JTextField jtf;
public void init(){
Container c = getContentPane();
c.setLayout(new FlowLayout());
ImageIcon ii = new ImageIcon("");
JButton but = new JButton(ii);
but.setActionCommand("myButton");
but.addActionListener(this);
c.add(but);
jtf = new JTextField(10);
c.add(jtf);
public void actionPerformed(ActionEvent ae){
jtf.setText(ae.getActionCommand());
The html is::
<html>
<body>
<applet code="JButtonDemo.class" width="250" height="150">
</applet
>
</body>
</html>
Its getting compiled but when I'm trying to run it like..
appletviewer JButtonDemo.html
its throwing the following error ..
java.security.AccessControlException: access denied (java.io.FilePermission read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)
at java.security.AccessController.checkPermission(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
at java.lang.SecurityManager.checkRead(SecurityManager.java:863)
at sun.awt.SunToolkit.getImageFromHash(SunToolkit.java:472)
at sun.awt.SunToolkit.getImage(SunToolkit.java:486)
at javax.swing.ImageIcon.<init>(ImageIcon.java:81)
at javax.swing.ImageIcon.<init>(ImageIcon.java:107)
at JButtonDemo.init(JButtonDemo.java:10)
at sun.applet.AppletPanel.run(AppletPanel.java:353)
at java.lang.Thread.run(Thread.java:534)
could anyone pls help me in rectifying this problem...
Thanks in advance
SrinivasYou must have missed something, here is how I got it to work:
appelt in c:\temp\test.java:import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JTextField;
public class test extends JApplet implements ActionListener {
JTextField jtf;
public void init() {
Container c = getContentPane();
c.setLayout(new FlowLayout());
ImageIcon ii = new ImageIcon("c:/test.jpg");
JButton but = new JButton(ii);
but.setActionCommand("myButton");
but.addActionListener(this);
c.add(but);
jtf = new JTextField(10);
c.add(jtf);
public void actionPerformed(ActionEvent ae) {
jtf.setText(ae.getActionCommand());
}html file in c:\temp:<DIV id="lblOutputText">Output comes here</DIV>
<object
classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
codebase = "http://java.sun.com/update/1.5.0/jinstall-1_5-windows-i586.cab"
>
<PARAM NAME = CODE VALUE = test >
<PARAM NAME = ARCHIVE VALUE = sTest.jar >
<param name = "type" value = "application/x-java-applet">
<param name = "scriptable" value = "false">
<comment>
<embed
type = "application/x-java-applet" \
CODE = test \
ARCHIVE = sTest.jar
scriptable = false
pluginspage = "http://java.sun.com/products/plugin/index.html#download">
<noembed>
</noembed>
</embed>
</comment>
</object>The batch file creating the signed jar in c:\temp\sign.batdel *.cer
del *.com
del *.jar
del *.class
javac test.java
keytool -genkey -keystore harm.com -keyalg rsa -dname "CN=Harm Meijer, OU=Technology, O=org, L=Amsterdam, ST=, C=NL" -alias harm -validity 3600 -keypass password -storepass password
rem keytool -export -alias harm -file exportPublicKey.cer -keystore harm.com -storepass password
jar cf0 test.jar test.class
jarsigner -keystore harm.com -storepass password -keypass password -signedjar sTest.jar test.jar harm
del *.class
pause
Maybe you are looking for
-
Help need in drag drop operation in AIR application
I would like to know if there is a way to drag and drop an attachment file from an desktop mail client application(similar to MSoutlook) into an AIR application and make it accessible to the AIR application. I did experiments with this the drag oper
-
Numbers spreadsheet will not open in Windows 8 Metro
When I tap or double-tap on a Numbers for iCloud spreadsheet in Windows 8.1 using Internet Explorer in Metro mode, nothing happens. Other buttons work. Long-pressing brings up the contextual menu, and the items in that menu work. I can even change th
-
Install Flash Player crashes on macbook with Yosemite 10.10.2
I've tried repeatedly to clean install Adobe Flash Player, but the installer crashes systematically. Here are my steps so far: Uninstalled Flash Player with Installer Downloaded Adobe Flash Player dmg Open dmg Double click Install Flash Player Click
-
I finally got all problems resolved to find another one. I made my router require a WEP to access it wirelessly, and disconnected my laptop from the connection. When I reconnected I come on to find myself greeted with "limited or no connectivity" aft
-
Mass Role Import -- 9000 derived roles with 9 org Levels, how to get TXT
Hello, I hava a problem. I want to use the (Mass Role Import) Bulk Role Import element in the ERM (SAP GRC AC 5.3 )for importing SAP roles (I only found that way to import roles from SAP). I have 100 primary roles and more or less 9000 derived roles