Exception: java.security.AccessControlException
hi, im writing a swing applet that uses a gif in a toolbar. it works fine in the appletviewer but when i try and run it in IE i get the following message:
Exception: java.security.AccessControlException: access denied(java.io.FilePermission new.gif read). i dont think theres a problem with the gif, ive tried using one from a Swing applet from Sun and get the same message.
id be grateful for any help
thanks
shargil
Hi.. I had the same exception some time ago. This should fix the problem:
In you policy file, e.g. HelloPolicy you shuld add this to your grant permission:
permission java.io.FilePermission "C:${/}YourPages${/}HelloApplet${/}yourpic.gif", "read";
This should fix the problem... I hope :-)
/Bo
Similar Messages
-
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. -
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? -
Java.security.AccessControlException when executing java from the DB
Hello
I'm running a Oracle 10.1.0.3.0 on Linux
I'm having trouble with executing some java code from the DB.
I created following java stored procedure used to create the directory given by the parameter
package be.vlaamsparlement.dis.os_commands;
import java.io.*;
import java.lang.*;
import java.sql.*;
import java.util.*;
public class ManageOSDirectory {
public static String createDir(String directoryName) throws Exception
if ((new File(directoryName)).mkdirs())
{ return ("TRUE");}
else
{ return ("FALSE");}
Wrapped it in a pl/sql procedure an execute it as follows under DB schema DIS :
begin
declare
b boolean;
begin
b := pck$os_commands.CreateDir('/data/files/vp_docs/schv/2004-2005/jan/1/');
end;
end;
Where /data/files/vp_docs/schv/ already exist, so the proc needs to create the direcories '2004-2005', 'jan' and '1'
this gives me following error :
ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException:
the Permission (java.io.FilePermission /data/files/vp_docs/schv/2004-2005/month/1 write) has not been granted to DIS.
The PL/SQL to grant this is dbms_java.grant_permission( 'DIS', 'SYS:java.io.FilePermission', '/data/files/vp_docs/schv/2004-2005/jan/1', 'write' )
I can't give this permission as the given directory does not yet exist. File permissions on os are ok and when i execute
the code on the os (not from the DB) it works fine.
This also worked on a Windows 10G DB without any extra grants.
Also, i can execute the followint
b := pck$os_commands.CreateDir('/data/files/vp_docs/schv/2004-2005/');
but if i then execute
b := pck$os_commands.CreateDir('/data/files/vp_docs/schv/2004-2005/jan/');
I get the same error. So i can only creaet 1 directory beneath the schv directory
Any ideas anyone ?The Error message is right.
You need to:
Ensure the Directory exist in Unix.
Create the Directory in the Database as SYS.
Grant Read,Write permission on th DIrectory to DIS
Grant Java permission on th DIrectory to DIS (using the syntax already shown in the Error message).
See my example below (10g R1)
SQL> connect /as sysdba
Connected.
SQL> GRANT CONNECT,RESOURCE TO DIS IDENTIFIED BY DIS;
Grant succeeded.
SQL> create or replace directory DIS_DOWNLOAD_DIR as '/data/files/vp_docs/schv/2004-2005/month/1';
Directory created.
SQL> col DIRECTORY_PATH format a50
SQL> select * from dba_directories;
OWNER DIRECTORY_NAME DIRECTORY_PATH
SYS DIS_DOWNLOAD_DIR /data/files/vp_docs/schv/2004-2005/month/1
1 row selected.
SQL> GRANT READ,WRITE ON DIRECTORY "SYS"."DIS_DOWNLOAD_DIR" TO "DIS";
Grant succeeded.
SQL> EXECUTE DBMS_JAVA.GRANT_PERMISSION( 'DIS', 'SYS:java.io.FilePermission', '/data/files/vp_docs/schv/2004-2005/jan/1', 'write' )
2 /
PL/SQL procedure successfully completed.
SQL> -
Hi All,
I'm building an web service that needs to make an URL connection.
In order to build the connection, I must set the proxy.
The problem is it seems that I cannot do
Properties Sys=System.getProperties();
since it results in the following exception :
java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
here is part of my code (part of the implementation of the SEI of my web service)
Properties Sys=System.getProperties();
Sys.put("proxySet","true");
Sys.put("proxyPort","8080");
Sys.put("proxyHost","webcache.singapore.sun.com");
URL url = new URL("http://www.geobytes.com/IpLocator.htm?GetLocation");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
I'm using SUN App Server 8, my IDE is netbeans 4.1
Any other way in setting the proxy without getting properties from my system? or any work around to make my code working. Please help me, any suggestions are highly appreciated.
Regards,
maggyI have changed the server.policy and adding the read access permission, now everything can work properly.
thanks -
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 AMHi,
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 -
Hello,
I am very near to complete my this task but every time i think this i find myself stuck in a new exception. Plz get me out of it.My problem is:
I created a client/server chat applet for providing online support to our company site visitors. Both server and client are applet.I am using serversocket at server side and socket(getCodeBase()) at client side to establish the connection.
The code compiled and run fine, without any exception or error when i run it on a standalone PC (althought PC is in LAN but i used that PC name to connect to itself).
But when i uploaded the applet on my personal site (i don't know any other way to test it:- dont know how to use tomcat even yet.) it is throwing an exception:-
java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM)
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)
at Connect.run(ClientChat.java:229)
at java.lang.Thread.run(Unknown Source)
I didnt made it jar or signed the applet which is not needed bcoz applet is trying to make connection to the site it is loaded from. I think i have to grant permission in the policy file and then complie it again. But i couldnt find which permission to grant. Plz pull me out of this problem, I dont want to drown on shore.
Thanx in advance CHAO
luv
Manuat java.lang.Runtime.exit(Unknown Source)
at java.lang.System.exit(Unknown Source)
at Connect.run(ClientChat.java:229)
at java.lang.Thread.run(Unknown Source)You can't call System.exit() from an Applet - there might be other things running in the JVM that you would be killing. Stop that.
Grant -
Logging-helloworld gets java.security.AccessControlException
Hello,
I deployed the logging-helloworld.ear from the Sun ONE AS 7 examples.
When I click the process button at the welcome screen I get these error messages. Has anyone the same problem and maybe an explanation with a solution?
SEVERE: StandardWrapperValve[LoggingServlet]: Servlet.service() for servlet LoggingServlet threw exception
java.security.AccessControlException: access denied (java.util.logging.LoggingPermission control)
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.util.logging.LogManager.checkAccess(LogManager.java:759)
at java.util.logging.Logger.removeHandler(Logger.java:1147)
at samples.logging.simple.servlet.GreeterServlet.initLog(GreeterServlet.java:117)
at samples.logging.simple.servlet.GreeterServlet.doGet(GreeterServlet.java:53)
at samples.logging.simple.servlet.GreeterServlet.doPost(GreeterServlet.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
RegardsI thought by selecting 'System.err.println' it should work for sure. But it does not .
When I add the grant codeBase lines, every selection works.
But it worked not with:
grant codeBase "file:${com.sun.aas.instanceRoot}/domains/domain1 ...
It only worked with :
grant codeBase "file:D:/Sun/AppServer7/domains/domain1 ...
Where is this env entry set ?
Regards -
Getting java.security.AccessControlException
Platform:
OS: Sun OS 5.7
Weblogic Server 5.1.0
Service Pack 5
I've weblogic installed at /home/hement/sw/weblogic.
I'm deploying a bean (Session bean), which is simply creating an instance of
another class "SecurityTest" and calling its method in which I'm creating a
new SecurityManager. This class is in /home/hement/ejb directory.
Now when I invoke this bean, using a weblogic.policy file with following
lines:
-------------weblogic.policy----------------------
grant {
permission java.security.AllPermission;
the bean works fine, and the new SecurityManager is created.
But, if the change the above weblogic.policy file to
-------------weblogic.policy----------------------
grant codeBase "file:/home/-" {
permission java.security.AllPermission;
grant codeBase "file:${java.home}/-" {
permission java.security.AllPermission;
grant {
// Permission "enableSubstitution" needed to run the WebLogic console
permission java.io.SerializablePermission "enableSubstitution";
// Permission "modifyThreadGroup" required to run the WebLogic Server
permission java.lang.RuntimePermission "modifyThreadGroup";
permission java.lang.RuntimePermission "setContextClassLoader";
// Permission "setIO" needed to start a server from the WebLogic console
permission java.lang.RuntimePermission "setIO";
// Permission "getClassLoader" needed for many EJB clients
permission java.lang.RuntimePermission "getClassLoader";
permission java.lang.RuntimePermission "stopThread";
permission java.net.SocketPermission "localhost:1024-", "listen";
permission java.util.PropertyPermission "java.version", "read";
permission java.util.PropertyPermission "java.vendor", "read";
permission java.util.PropertyPermission "java.vendor.url", "read";
permission java.util.PropertyPermission "java.class.version", "read";
permission java.util.PropertyPermission "os.name", "read";
permission java.util.PropertyPermission "os.version", "read";
permission java.util.PropertyPermission "os.arch", "read";
permission java.util.PropertyPermission "file.separator", "read";
permission java.util.PropertyPermission "path.separator", "read";
permission java.util.PropertyPermission "line.separator", "read";
permission java.util.PropertyPermission "java.specification.version",
"read";
permission java.util.PropertyPermission "java.specification.vendor",
"read";
permission java.util.PropertyPermission "java.specification.name", "read";
permission java.util.PropertyPermission "java.vm.specification.version",
"read";
permission java.util.PropertyPermission "java.vm.specification.vendor",
"read";
permission java.util.PropertyPermission "java.vm.specification.name",
"read";
permission java.util.PropertyPermission "java.vm.version", "read";
permission java.util.PropertyPermission "java.vm.vendor", "read";
permission java.util.PropertyPermission "java.vm.name", "read";
------------------------exception-----------------
the bean doesn't work fine, and throws the followig exception:
java.security.AccessControlException: access denied
(java.lang.RuntimePermission
createSecurityManager )
at
java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java, Compiled Code)
at
java.security.AccessController.checkPermission(AccessController.java,
Compiled Code)
at java.lang.SecurityManager.checkPermission(SecurityManager.java,
Compi
led Code)
at java.lang.SecurityManager.<init>(SecurityManager.java, Compiled
Code)
at SecurityCreator.createSecurityManager(SecurityCreator.java,
Compiled
Code)
at ejbtests.securitytests.TestBean.testSecurity(TestBean.java,
Compiled
Code)
at
ejbtests.securitytests.TestBeanEOImpl.testSecurity(TestBeanEOImpl.jav
a, Compiled Code)
at
ejbtests.securitytests.TestBeanEOImpl_WLSkel.invoke(TestBeanEOImpl_WL
Skel.java, Compiled Code)
at
weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerOb
jectAdapter.java, Compiled Code)
at
weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicReques
tHandler.java, Compiled Code)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
.java, Compiled Code)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)
Wed Sep 13 17:07:53 EDT 2000:<I> <EJB JAR deployment
/home/hsasan/sw/weblogic/cl
asses/myClasses/securitytest.jar> Exception in non-transactional EJB invoke:
java.rmi.RemoteException: java.security.AccessControlException: access
denied (j
ava.lang.RuntimePermission createSecurityManager ); nested exception is:
java.security.AccessControlException: access denied
(java.lang.RuntimePe
rmission createSecurityManager )
java.security.AccessControlException: access denied
(java.lang.RuntimePermission
createSecurityManager )
at
java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java, Compiled Code)
at
java.security.AccessController.checkPermission(AccessController.java,
Compiled Code)
at java.lang.SecurityManager.checkPermission(SecurityManager.java,
Compi
led Code)
at java.lang.SecurityManager.<init>(SecurityManager.java, Compiled Code)
at SecurityCreator.createSecurityManager(SecurityCreator.java,
Compiled
Code)
at ejbtests.securitytests.TestBean.testSecurity(TestBean.java,
Compiled
Code)
at
ejbtests.securitytests.TestBeanEOImpl.testSecurity(TestBeanEOImpl.jav
a, Compiled Code)
at
ejbtests.securitytests.TestBeanEOImpl_WLSkel.invoke(TestBeanEOImpl_WL
Skel.java, Compiled Code)
at
weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerOb
jectAdapter.java, Compiled Code)
at
weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicReques
tHandler.java, Compiled Code)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
.java, Compiled Code)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)
Any idea, why is it behaving like this? Your comments will be appreciated.
Thanks,
- HementWell, the reason of the error is:
netstat -o -n -a | findstr 1099
TCP 0.0.0.0:1099 0.0.0.0:0 LISTENING 2300This means the port 1099 is being used by any other Application.
Regards
Taton -
Putting images in an applet - java.security.AccessControlException
So I made this Blackjack game using many many classes and a GUI and it worked fine. I then decided to put it online and turned it into an applet. This isn't my first applet that i've put online, so I know that I did all the syntax in the code right. On the other hand, this is the first applet i've put online that includes pictures. The game has a Card class with an ImageIcon variable for the image of the card. The problem is that the applet won't run in a browser, and I receive the follow exception:
java.security.AccessControlException: access denied (java.io.FilePermission Back.png 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.checkRead(Unknown Source)
at sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at CardPanel.<init>(CardPanel.java:34)
at Dealer.<init>(Dealer.java:75)
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.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
"Back.png" refers to a picture of the back of the card. I have this picture, along with the other 52 card pictures uploaded to the website (i'm hosting on Netfirms). Please help me. I'm willing to share any necessary source code if the need arises.You're trying to read the images off the local hard drive or from a server other than the one the applet came from.
That's normally not allowed.
Use Class.getResource and/or getResourceAsStream, and javax.imageio.ImageIO.read, to read the images. You specify the image paths as relative to the applet (e.g., don't start them with "C:\"). -
How to resolve java.security.AccessControlException
I wrote a component for serverside(Remote interface,Remote Interface implementation class,stub,skel.. e.t.c) under RMI APIs,but when I m running the class in which i have implemented remote interface throw
a security exception java.security.AccessControlException:access denied<java.net.SocketPermission localhostDistributed resolved>.
can someone suggest me whether it is problem of My computer's security settings or there is some problem in java.policy file.Is there any other way to get rid of this problem.
I also need help to configure my policy file...
Thankyou....
Here below I m giving soure code of class (which is throwing exception and implements remote interface "DistributedEx")
import java.rmi.*;
import java.rmi.server.*;
public class DistributedExmpl extends UnicastRemoteObject implements
DistributedEx
static String hostname="localhost";
static String data[]={"First String"
"Second String"
"Third String"};
public DistributedExmpl()throws RemoteException
super();
public int getDataNum()throws RemoteException
return data.length;
public String getData(int n)throws RemoteException
return data[n%data.length];
public static void main(String args[])
System.setSecurityManager(new RMISecurityManager());
try{
DistributedExmpl instance =new DistributedExmpl();
Naming.rebind("//"+hostname+"Distributed",instance);
System.out.println("Regiterd Now");
catch(Exception ex)
System.out.println(ex);
}The program tried to resolve your "hostname" to an IP address using your machine's naming service. However it needs the "resolve" socket permission.
You can change your default socket permssion from
permission java.net.SocketPermission "localhost:1024-", "listen";to
permission java.net.SocketPermission "localhost:1024-", "listen,resolve";or you can just remove the following line if your RMI server doesn't download classes:
System.setSecurityManager(new RMISecurityManager()); -
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, Portugalhi 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 -
Hi Everybody
I downloaded and installed weblogic as per the installation document
but I am getting the following exception and finally the server
is started. Can somebody help me to resolve this problem
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.jts.internal.TransactionManagerImpl.<init>(TransactionManagerImpl.java:24)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:35 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.jts.internal.CoordinatorFactoryImpl.start(CoordinatorFactoryImpl.java:52)
at weblogic.jts.internal.TransactionManagerImpl.<init>(TransactionManagerImpl.java:33)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:35 EST 2001:<I> <WebLogicServer> Invoking main-style
startup weblogic.jdbc.common.internal.JdbcStartup weblogic.jdbc.common.internal.JdbcStartup
Wed Feb 28 12:55:35 EST 2001:<E> <JDBC Init> ERROR: Could not get
JNDI context: javax.naming.NoInitialContextException: Cannot instantiate
class: weblogic.jndi.WLInitialContextFactory [Root exception is
java.security.AccessControlException: access denied (java.lang.RuntimePermission
getClassLoader )]
Wed Feb 28 12:55:35 EST 2001:<I> <JMS> Beginning startup process
Wed Feb 28 12:55:35 EST 2001:<I> <JMS> Init JMS Security
Wed Feb 28 12:55:35 EST 2001:<I> <JMS> Initializing from weblogic.properties
Wed Feb 28 12:55:35 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.jms.server.JMSManager.getContext(JMSManager.java:851)
at weblogic.jms.server.JMSManager.getContext(JMSManager.java:835)
at weblogic.jms.server.JMSManager.doInitFromProperties(JMSManager.java:483)
at weblogic.jms.server.JMSManager.initFromProperties(JMSManager.java:472)
at weblogic.jms.server.JMSManager.init(JMSManager.java:299)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:35 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.jms.server.JMSManager.getContext(JMSManager.java:851)
at weblogic.jms.server.JMSManager.doInitFromProperties(JMSManager.java:488)
at weblogic.jms.server.JMSManager.initFromProperties(JMSManager.java:472)
at weblogic.jms.server.JMSManager.init(JMSManager.java:299)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<I> <JMS> Startup process complete.
JMS is active
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.jms.server.JMSManager.getContext(JMSManager.java:851)
at weblogic.jms.server.JMSManager.initSessionPoolManager(JMSManager.java:317)
at weblogic.jms.server.JMSManager.init(JMSManager.java:308)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<I> <JMS> Bound SessionPoolManager
as weblogic.jms.SessionPoolManager
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.jms.server.JMSManager.getContext(JMSManager.java:851)
at weblogic.jms.server.JMSManager.initConnectionConsumerManager(JMSManager.java:333)
at weblogic.jms.server.JMSManager.init(JMSManager.java:310)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<I> <JMS> Bound ConnectionConsumerManager
as weblogic.jms.ConnectionConsumerManager
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.t3.srvr.T3Srvr.bindServer(T3Srvr.java:1476)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(Compiled
Code)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.t3.srvr.T3Srvr.bindServer(T3Srvr.java:1495)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<I> <WebLogicServer> Invoking main-style
startup RMI Registry weblogic.rmi.internal.RegistryImpl
Wed Feb 28 12:55:36 EST 2001:<I> <RMI> Registry started
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(Compiled
Code)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.common.internal.T3BindableServices.initialize(T3BindableServices.java:114)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(Compiled
Code)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.ejb.internal.EJBManagerImpl.bindToJNDI(EJBManagerImpl.java:580)
at weblogic.ejb.internal.EJBManagerImpl.<init>(EJBManagerImpl.java:226)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<E> <EJB> Cannot intialize Mail Session
resources because could not get JNDI context: javax.naming.NoInitialContextException:
Cannot instantiate class: weblogic.jndi.WLInitialContextFactory
[Root exception is java.security.AccessControlException: access
denied (java.lang.RuntimePermission getClassLoader )]
Wed Feb 28 12:55:36 EST 2001:<I> <EJB> 0 EJB jar files loaded,
containing 0 EJBs
Wed Feb 28 12:55:36 EST 2001:<I> <EJB> 0 deployed, 0 failed to
deploy.
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(Compiled
Code)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(Compiled
Code)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.io.common.internal.T3FileSystemProxyImpl.installFileSystems(Compiled
Code)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<E> <ServletContext-General> cannot
make temp directory '/opt/weblogic/myserver/public_html/_tmp_war',
will not be able to compile JSPs
Wed Feb 28 12:55:36 EST 2001:<E> <HTTP> Cannot intialize httpd
URL resources because could not get JNDI context: javax.naming.NoInitialContextException:
Cannot instantiate class: weblogic.jndi.WLInitialContextFactory
[Root exception is java.security.AccessControlException: access
denied (java.lang.RuntimePermission getClassLoader )]
Lot of thanks for your help.Check the weblogic.policy file to make sure that it is giving permissions to the right directories. If you have
installed a Service Pack, make sure that both service pack jar files are at the front of their corresponding
classpaths...
vj wrote:
Hi Everybody
I downloaded and installed weblogic as per the installation document
but I am getting the following exception and finally the server
is started. Can somebody help me to resolve this problem
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.jts.internal.TransactionManagerImpl.<init>(TransactionManagerImpl.java:24)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:35 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.jts.internal.CoordinatorFactoryImpl.start(CoordinatorFactoryImpl.java:52)
at weblogic.jts.internal.TransactionManagerImpl.<init>(TransactionManagerImpl.java:33)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:35 EST 2001:<I> <WebLogicServer> Invoking main-style
startup weblogic.jdbc.common.internal.JdbcStartup weblogic.jdbc.common.internal.JdbcStartup
Wed Feb 28 12:55:35 EST 2001:<E> <JDBC Init> ERROR: Could not get
JNDI context: javax.naming.NoInitialContextException: Cannot instantiate
class: weblogic.jndi.WLInitialContextFactory [Root exception is
java.security.AccessControlException: access denied (java.lang.RuntimePermission
getClassLoader )]
Wed Feb 28 12:55:35 EST 2001:<I> <JMS> Beginning startup process
Wed Feb 28 12:55:35 EST 2001:<I> <JMS> Init JMS Security
Wed Feb 28 12:55:35 EST 2001:<I> <JMS> Initializing from weblogic.properties
Wed Feb 28 12:55:35 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.jms.server.JMSManager.getContext(JMSManager.java:851)
at weblogic.jms.server.JMSManager.getContext(JMSManager.java:835)
at weblogic.jms.server.JMSManager.doInitFromProperties(JMSManager.java:483)
at weblogic.jms.server.JMSManager.initFromProperties(JMSManager.java:472)
at weblogic.jms.server.JMSManager.init(JMSManager.java:299)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:35 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.jms.server.JMSManager.getContext(JMSManager.java:851)
at weblogic.jms.server.JMSManager.doInitFromProperties(JMSManager.java:488)
at weblogic.jms.server.JMSManager.initFromProperties(JMSManager.java:472)
at weblogic.jms.server.JMSManager.init(JMSManager.java:299)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<I> <JMS> Startup process complete.
JMS is active
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.jms.server.JMSManager.getContext(JMSManager.java:851)
at weblogic.jms.server.JMSManager.initSessionPoolManager(JMSManager.java:317)
at weblogic.jms.server.JMSManager.init(JMSManager.java:308)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<I> <JMS> Bound SessionPoolManager
as weblogic.jms.SessionPoolManager
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.jms.server.JMSManager.getContext(JMSManager.java:851)
at weblogic.jms.server.JMSManager.initConnectionConsumerManager(JMSManager.java:333)
at weblogic.jms.server.JMSManager.init(JMSManager.java:310)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<I> <JMS> Bound ConnectionConsumerManager
as weblogic.jms.ConnectionConsumerManager
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:240)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.t3.srvr.T3Srvr.bindServer(T3Srvr.java:1476)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(Compiled
Code)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.t3.srvr.T3Srvr.bindServer(T3Srvr.java:1495)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<I> <WebLogicServer> Invoking main-style
startup RMI Registry weblogic.rmi.internal.RegistryImpl
Wed Feb 28 12:55:36 EST 2001:<I> <RMI> Registry started
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(Compiled
Code)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.common.internal.T3BindableServices.initialize(T3BindableServices.java:114)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(WLInitialContextFactoryDelegate.java:279)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(Compiled
Code)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.ejb.internal.EJBManagerImpl.bindToJNDI(EJBManagerImpl.java:580)
at weblogic.ejb.internal.EJBManagerImpl.<init>(EJBManagerImpl.java:226)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<E> <EJB> Cannot intialize Mail Session
resources because could not get JNDI context: javax.naming.NoInitialContextException:
Cannot instantiate class: weblogic.jndi.WLInitialContextFactory
[Root exception is java.security.AccessControlException: access
denied (java.lang.RuntimePermission getClassLoader )]
Wed Feb 28 12:55:36 EST 2001:<I> <EJB> 0 EJB jar files loaded,
containing 0 EJBs
Wed Feb 28 12:55:36 EST 2001:<I> <EJB> 0 deployed, 0 failed to
deploy.
Wed Feb 28 12:55:36 EST 2001:<E> <Service>
java.lang.reflect.InvocationTargetException: java.security.AccessControlException:
access denied (java.lang.RuntimePermission setContextClassLoader
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(Compiled Code)
at java.lang.SecurityException.<init>(Compiled Code)
at java.security.AccessControlException.<init>(Compiled Code)
at java.security.AccessControlContext.checkPermission(Compiled
Code)
at java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled Code)
at java.lang.Thread.setContextClassLoader(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.jndi.internal.Utils.setContextClassLoader(Utils.java:73)
at weblogic.jndi.WLInitialContextFactoryDelegate.newLocalContext(Compiled
Code)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(Compiled
Code)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Compiled
Code)
at weblogic.jndi.Environment.getContext(Environment.java:122)
at weblogic.jndi.Environment.getInitialContext(Environment.java:105)
at weblogic.io.common.internal.T3FileSystemProxyImpl.installFileSystems(Compiled
Code)
at weblogic.t3.srvr.T3Srvr.start(Compiled Code)
at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:825)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.Server.startServerDynamically(Server.java:99)
at weblogic.Server.main(Server.java:65)
at weblogic.Server.main(Server.java:55)
Wed Feb 28 12:55:36 EST 2001:<E> <ServletContext-General> cannot
make temp directory '/opt/weblogic/myserver/public_html/_tmp_war',
will not be able to compile JSPs
Wed Feb 28 12:55:36 EST 2001:<E> <HTTP> Cannot intialize httpd
URL resources because could not get JNDI context: javax.naming.NoInitialContextException:
Cannot instantiate class: weblogic.jndi.WLInitialContextFactory
[Root exception is java.security.AccessControlException: access
denied (java.lang.RuntimePermission getClassLoader )]
Lot of thanks for your help. -
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? -
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
Maybe you are looking for
-
Odd compile errors using a struct in a vector
I am following Accelerated C++ by Koenig and Moo to learn C++, using Eclipse as my IDE and the MinGW tool chain. Chapter 4 teaches about the struct concept using a pretty simple multi-file example program which emulates reading in a series of student
-
Not compatible with this version of photoshop error
I have been working on a file all day, closed the file, when to open it again and Photoshop is telling me "Could not complete your request because the file is not compatible with this version of photoshop". HELP. Anyone know why it is giving me this
-
I am having problem downloading videos to youtube. Any suggestions? Thx
I had no problem untill yesterday. Now I can not download any videos? Any ideas please..Thank you
-
I've tried everything. Reinstalling the Updater, Itunes, Restarting my computer. Everything. I try to run it and then it just comes up with an error message that it needs to close down for some reason. Please help, I'm dying without it!
-
On new mbp should we upgrade or do a clean install
The title says it all. My friend just bought a new mbp and he is wondering if he should do one or the other or none. There are no third party anything yet on the machine. Has not yet turned it on What do you all recommend, I cannot recommend anything