Java.io.FilePermission

I am baffled by a security.AccessControlException that I get when I try to start an RMI server.
The server sets an RMISecurityManager(), then creates an engine that extends UnicastRemoteObject and attempts to bind it (on localhost) with Naming.rebind(...). There it fails:
RemoteCalcServer exception: access denied (java.io.FilePermission \\C\Projects\OmegaClient\classes read)
java.security.AccessControlException: access denied (java.io.FilePermission \\C\Projects\OmegaClient\classes read)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
     at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
     at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:354)
     at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
     at java.rmi.Naming.rebind(Naming.java:160)
at com.tibotec.isclient.calc.server.RemoteCalcServer.main(RemoteCalcServer.java:52)
The policy file is:
grant codeBase "file://C:/Projects/OmegaClient/classes/-" {
permission java.io.FilePermission "\\C\\Projects\\OmegaClient\\classes\\", "read";
permission java.net.SocketPermission "localhost:1024-", "listen, accept, connect";
It must be correctly loaded and used, because a (different) exception is generated when I comment out the SocketPermission. But why does RMI complain about not having reading permission on that directory (the codeBase, and its value must be correct, or else I should get ClassNotFound exceptions)?
I have tried every almost imaginable change to the directory syntax, including including "C:\\-", "file://C:/-", and "<<ALL FILES>>" but those don't help...
Emmanuel

did you find out what the problem was in the end??
Im in a similar predicament.
Decided i would have a look at some of the tutorials so i took the nice and easy hello world.
You can find it here
http://java.sun.com/j2se/1.5.0/docs/guide/rmi/hello/hello-world.html
Anyways when it comes down to running it i run into all sorts of problems. Im using the jdk1.5 Update 13.
I trying to run both the server locally on my machine. My first exception i run into is
(Package name differs slightly to the example but everything else is the same)
Server exception: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: hello.Hello
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: hello.Hello
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown
Ok all class files are there and sit in the same package and tells me it cant find the Hello class. So i then set the
Djava.rmi.server.codebase attribute to my classes directory. So then i move onto to my next exception
Server exception: java.security.AccessControlException: access denied (java.io.FilePermission \\c\eclipse\workspace\helloworld\bin read)
java.security.AccessControlException: access denied (java.io.FilePermission \\c\eclipse\workspace\helloworld\bin read)
So i then create a policy file and grant all access.(Which im thinking i shouldnt be doing this because everything is local)
So i then specify it on the command line Djava.security.policy= grant all policy
Still get the same problem, what i dont get is why i need this when i run everything local, my understanding is that if you run it locally you dont need to specify a security policy file and codebase.
if gives no indication in the tutorial either that you need this. Anyone any ideas how i can get this simple thing to work!!
Cheers,
LL

Similar Messages

  • Java.io.filepermission error while executing a batch file from java prog

    Hi,
    i want run a java program which executes a batch file, both are in a jar file. while am trying this using webstart it shows error:access denied java.io.filepermission <<ALL FILES>>execute. why this happens how to rectify this.
    By
    Vinod

    Clearly, it would be a security vulnerability to be able to do such a thing from the web w/o user granting trust to the application.
    Java Web Start applications run in the Java SE secure sandbox unless they have been granted all-permissions by the user:
    1.) sign all jar files.
    2.) add <security><all-permissions/></security> to the jnlp file.
    The user would then be prompted to grant trust to the applications.
    /Andy

  • Java.io.FilePermission error while writing file to disk

    Hi All,
    I have done a simple JSP form in which am uploading a file to the server, am using apache commons file upload, in my local system its working fine(windows), but when i uploaded the same to the shared server(Linux), tomcat throwing a exception when java class file trying to write the file to disk, i have given all permissions (read,write,execute) to all users to the target folder("timeSheet_uploadedFiles") where am trying to write the file and tried but no luck still the exception continues, below i copied the exception am getting, somebody please help me.
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: access denied (java.io.FilePermission /var/chroot/home/content/html/timeSheet_uploadedFiles/admin_4_5_CSharp Coding Standards.pdf write)
         org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
         org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
    root cause
    java.security.AccessControlException: access denied (java.io.FilePermission /var/chroot/home/content/html/timeSheet_uploadedFiles/admin_4_5_CSharp Coding Standards.pdf write)
         java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
         java.security.AccessController.checkPermission(AccessController.java:427)
         java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
         java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
         java.io.FileOutputStream.<init>(FileOutputStream.java:169)
         java.io.FileOutputStream.<init>(FileOutputStream.java:70)
         com.roots.UploadAction.upload(UploadAction.java:72)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
         org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
         org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.
    Apache Tomcat/5.0.27Thanks,
    vyrav.

    You have apparently missed setting the write permission to the target directory for the user that Tomcat is running as. Tomcat may be running as a different user than the one you are logged into on the system.
    It may be trying to save to an incorrect location, so double check the directory is what you expect it to be.
    The file may already exist, so it may not be able to over-write the file, so make sure you give the tomcat user the ability to delete and overwrite as well as write - or check if the file exists before writing and warn user if you don't want to give delete permissions.

  • Access denied (java.io.FilePermission c:\hello.html read

    hi all,
    i'm trying to run an application in web start which runs otherwise absolutely fine.i have made a tree application .if i press a link in a node it opens another page in jeditor pane which is on the other side of the split pane.every time i try to open a page it gives me the following exception
    Exception occurred during event dispatching:
    java.security.AccessControlException: access denied (java.io.FilePermission c:\Program Files\Apache Tomcat 4.0\webapps\web\hello.html 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 java.io.File.isDirectory(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.initializeHeaders(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.getHeaderField(Unknown Source)
         at sun.net.www.URLConnection.getContentType(Unknown Source)
         at javax.swing.JEditorPane.getStream(Unknown Source)
         at javax.swing.JEditorPane.setPage(Unknown Source)
         at browser.HelpPanel.displayURL(HelpPanel.java:156)
         at browser.HelpPanel.access$000(HelpPanel.java:37)
         at browser.HelpPanel$2.valueChanged(HelpPanel.java:74)
         at javax.swing.JTree.fireValueChanged(Unknown Source)
         at javax.swing.JTree$TreeSelectionRedirector.valueChanged(Unknown Source)
         at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(Unknown Source)
         at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(Unknown Source)
         at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(Unknown Source)
    i have given permissions for file io in jdk1.3 jre,tomcat 's catalina as well as in the java.policy file for this particular application which is in the jar folder but no use.can anybody tell me the solution.following is the content of my policy file.
    grant {
    permission java.net.SocketPermission "*:1024-65535",
    "connect,accept,resolve";
    permission java.net.SocketPermission "*:80", "connect";
    permission java.security.AllPermission;
    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 "user.dir", "read";
    permission java.util.PropertyPermission "dir", "read";
    permission java.io.FilePermission "c:\Program Files\Apache Tomcat 4.0\webapps\web\", "read,write,execute";
    thanks

    Hi sangeeta,
    I am working on java web start and have posted a query at the following link
    http://forum.java.sun.com/thread.jsp?forum=38&thread=328294
    I read your question and I found it similar to my problem.
    I was wondering if you could temm me exactly what file you had to modify under web start and what was the line that you had to put in.
    If the question is ambiguous .... and as an after thot it does look kinda that way please lemme know.
    Thanks
    Shahid
    hi all,
    i'm trying to run an application in web start which
    runs otherwise absolutely fine.i have made a tree
    application .if i press a link in a node it opens
    another page in jeditor pane which is on the other
    side of the split pane.every time i try to open a page
    it gives me the following exception
    Exception occurred during event dispatching:
    java.security.AccessControlException: access denied
    (java.io.FilePermission c:\Program Files\Apache Tomcat
    4.0\webapps\web\hello.html read)
    at
    java.security.AccessControlContext.checkPermission(Unk
    own Source)
    at
    java.security.AccessController.checkPermission(Unknown
    Source)
    at java.lang.SecurityManager.checkPermission(Unknown
    Source)
    at java.lang.SecurityManager.checkRead(Unknown
    Source)
         at java.io.File.isDirectory(Unknown Source)
    at
    sun.net.www.protocol.file.FileURLConnection.connect(Un
    nown Source)
    at
    sun.net.www.protocol.file.FileURLConnection.initialize
    eaders(Unknown Source)
    at
    sun.net.www.protocol.file.FileURLConnection.getHeaderF
    eld(Unknown Source)
    at sun.net.www.URLConnection.getContentType(Unknown
    Source)
         at javax.swing.JEditorPane.getStream(Unknown Source)
         at javax.swing.JEditorPane.setPage(Unknown Source)
         at browser.HelpPanel.displayURL(HelpPanel.java:156)
         at browser.HelpPanel.access$000(HelpPanel.java:37)
    at
    browser.HelpPanel$2.valueChanged(HelpPanel.java:74)
    at javax.swing.JTree.fireValueChanged(Unknown
    Source)
    at
    javax.swing.JTree$TreeSelectionRedirector.valueChanged
    Unknown Source)
    at
    javax.swing.tree.DefaultTreeSelectionModel.fireValueCh
    nged(Unknown Source)
    at
    javax.swing.tree.DefaultTreeSelectionModel.notifyPathC
    ange(Unknown Source)
    at
    javax.swing.tree.DefaultTreeSelectionModel.setSelectio
    Paths(Unknown Source)
    i have given permissions for file io in jdk1.3
    jre,tomcat 's catalina as well as in the java.policy
    file for this particular application which is in the
    jar folder but no use.can anybody tell me the
    solution.following is the content of my policy file.
    grant {
    permission java.net.SocketPermission
    ion "*:1024-65535",
    "connect,accept,resolve";
    permission java.net.SocketPermission "*:80",
    0", "connect";
    permission java.security.AllPermission;
    permission java.util.PropertyPermission
    ssion "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
    ssion "user.dir", "read";
    permission java.util.PropertyPermission "dir",
    dir", "read";
    permission java.io.FilePermission "c:\Program
    ogram Files\Apache Tomcat 4.0\webapps\web\",
    "read,write,execute";
    thanks

  • Why signed and get "access denied (java.io.FilePermission hello.txt read)"?

    I am learning the Java tools and policy to create some local browser application for personal use. So I signed a jar file with jarsigner, keytool and policytool and still trying to figure out why my browser application cannot read a simple local text file.
    My question are
    1. Why use java policy tool (policytool.exe)? If I signed a .jar with keytool and jarsigner, do I really need java policytool to write a policy?
    2. What is the maximum validity days? 365? or more? Do I need to sign again when validity expire?
    3. I don't want any of my local browser application gets to internet but only work with local files (read, write, or execute). how do I do that?
    4. how to use java security policy to grant access to the jar applet? where do I place and import the policy file so the hosting web browser and the applet can work?
    My java applet is a simple class that read a text line from a local file in the same folder, and pass the result to a calling web browser Javascript.
    Currently the result in the web page is the error message below, even though the jar is signed correctly.
    access denied (java.io.FilePermission hello.txt read)
    Someone please help and enlight the newbie!

    leoku wrote:
    I am learning the Java tools and policy to create some local browser application for personal use.Why would you wrap a mostly useless and unhelpful browser window around a Java app. for 'local' use?
    .. So I signed a jar file with jarsigner, keytool and policytool and still trying to figure out why my browser application cannot read a simple local text file.
    My question are
    1. Why use java policy tool (policytool.exe)? If I signed a .jar with keytool and jarsigner, do I really need java policytool to write a policy?No. In fact, don't stuff around with policy files - they are a path to madness.
    2. What is the maximum validity days? 365? or more?Keytool accepts an argument for the number of days to remain valid. I do not believe it has an upper limit, but it might be best to experiment with it and find out for yourself. Please report your findings back.
    (2a) Do I need to sign again when validity expire?No, but the end user gets a huge warning that the certificate has expired. Further, if it was a certificate that was certified by a CA, the 'always trust' check box which used to default to true, would now default to false.
    3. I don't want any of my local browser application gets to internet but only work with local files (read, write, or execute). how do I do that?I am not sure I understand, but if you only offer a JFileChooser for the applet to access resources, that should restrict it to resources off the local file-system. Of course, that would not restrict the end user from downloading something from the internet to their local disks, then accessing it using the applet.
    4. how to use java security policy to grant access to the jar applet? where do I place and import the policy file so the hosting web browser and the applet can work?The only place it will work is in the JRE directories of the end-user's machine. Even if you find a way to install your local policy file, do not go messing with the end-user's policy files.
    My java applet is a simple class that read a text line from a local file in the same folder,.. In the 'same folder' as what? (1)
    ..and pass the result to a calling web browser Javascript. That might be the problem. AFAIR, using JS with trusted applets causes the security to be tightened. Perhaps it could be fixed by calling System.setSecurityManager(null) on applet init(), but I have also seen references to using [AccessController.doPrivileged()|http://java.sun.com/j2se/1.4.2/docs/api/java/security/AccessController.html] to wrap the problematic code. I am hazy on the details of how/if that works.
    Currently the result in the web page is the error message below, even though the jar is signed correctly.
    access denied (java.io.FilePermission hello.txt read)
    1) If the answer to my question is what I suspect, there may be better ways to access the resource that are usable even in a sand-boxed app.

  • Java.io.FilePermission + Flex :(

    Hi Guys,
    i have a very strange problem and hope that u can help me. J
    I am developing an Air-App using a Coldfusion (Hoster is hostek.com) Backend. The Application has a User-Login which works correctly.
    After the login the app calls the server to get a full list of all members to display them into a Datagrid…
    Problem: On my localmashine both is working great. “Online” just the login works great… Calling the “getTeam” method causes an error:
    Error Loading team: [RPC Fault faultString="access denied (java.io.FilePermission D:\home\website.com\wwwroot\projects\teamplaner\Member.cfc read)"
    I just don’t get, why login works super and the other function (is in the same cfc) isn’t working.
    Again: local both is working…
    Any ideas? L
    Greetings from germany,
    nico

    STRANGE:
    I "solved" it...
    I am using customObjects in my application and on the server. (remoteClass....) If i am parsing an Object of that type to the function on the server there are no problems.... (of course this make sense if i am calling the "login" function... there i am parsing a UserVO instance containing username/password)
    anyway...
    in the "getTeam" method there is obviously no cfargument, just a returntype. (i am calling all users, without any specific propertys)
    Now i parsed an empty instance of that "UserObject" to my Cfc.component... Voila no error and i get the results i want....
    It seems that the server just "know" the objects i am parsing... doesn't make any sense for me.
    WTF? WHY?
    greets, nico

  • Can't run applet with appletviewer(java.io.FilePermission)

    Guys, I am writing an applet and it has compiled fine but when I try running it with appletviewer, it spews out these error. I have changed permissions on my .class file and .html file.
    Can anyone help? It's pretty frustrating...
    ava.security.AccessControlException: access denied (java.io.FilePermission /.automount/blah/usr/blah/blah/Node.class read)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
    at java.security.AccessController.checkPermission(AccessController.java:399)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
    at java.lang.SecurityManager.checkRead(SecurityManager.java:890)
    thanks.

    See if you find anything here:
    http://search.java.sun.com/search/java/index.jsp?col=javaforums&qp=%2Bforum%3A31&qt=%22java.security.AccessControlException%3A+access+denied+%22&x=17&y=14
    It�s a search on the forum, users with the same error.
    Andreas

  • Java.io.FilePermission Error

    So i am getting the following error when I attempt to upload a picure into my applet from my system. The applet has been signed and it does ask if I will accept the certificate. Yet I still get the error shown below. When I edit my java.policy file to allow all permissions it does work. So what do I need to do to make this work. Sort of useless if other can't upload stuff into my applet.
    java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\Philip DePalo\Documents\_TricksTrade\phil.jpg 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 java.io.File.isFile(Unknown Source)
         at org.apache.commons.httpclient.methods.multipart.FilePartSource.<init>(FilePartSource.java:67)
         at org.apache.commons.httpclient.methods.multipart.FilePart.<init>(FilePart.java:129)
         at ThumbnailHandler$UploadImage.actionPerformed(ThumbnailHandler.java:369)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.Dialog$1.run(Unknown Source)
         at java.awt.Dialog$3.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.awt.Dialog.show(Unknown Source)
         at java.awt.Component.show(Unknown Source)
         at java.awt.Component.setVisible(Unknown Source)
         at java.awt.Window.setVisible(Unknown Source)
         at java.awt.Dialog.setVisible(Unknown Source)
         at ThumbnailHandler$UploadImage.<init>(ThumbnailHandler.java:353)
         at ThumbnailHandler$1.actionPerformed(ThumbnailHandler.java:107)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.AbstractButton.doClick(Unknown Source)
         at javax.swing.AbstractButton.doClick(Unknown Source)
         at SessionClient$MenuItemListener.actionPerformed(SessionClient.java:500)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.AbstractButton.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)

    public void actionPerformed(ActionEvent e) {     
                try{
                    Object source = e.getSource();
                    if (source == okBtn) {
                       final PostMethod filePost = new PostMethod(uploadServer);
                        int listSize= fileListModel.size();
                        if (listSize <= 0) return;
                        try {
                            final Part[] parts= new Part[listSize];
                            for (int i=0; i<listSize; i++) {
                                File targetFile= new File((String)fileListModel.get(i));
                                parts= new FilePart(targetFile.getName(), targetFile);
    String strQuery= "tId=" + topicId
    + "&uploadPath=" + uploadPath;
    final String queryString= strQuery.replace(' ', '+');
    filePost.setQueryString(queryString);
    filePost.setRequestEntity(new MultipartRequestEntity(parts, filePost.getParams()));
    HttpClient client = new HttpClient();
    client.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
    int status = client.executeMethod(filePost);
    if (status == HttpStatus.SC_OK) {
    String strImage[];
    Vector fileList= new Vector();
    String str= filePost.getResponseBodyAsString();
    strImage= str.split(";");
    for (int i=0; i<strImage.length; i++){
    fileList.addElement(strImage[i]);
    addImages(fileList);
    JOptionPane.showMessageDialog(mainFrame, "Upload Images Successfully!"
    +System.getProperty("line.separator")
    +str);
    } else {
    JOptionPane.showMessageDialog(mainFrame, "Upload Images Fail!");
    } catch (Exception ex) {
    ex.printStackTrace();
    } finally {
    filePost.releaseConnection();
    uploadDialog.dispose();
    else if (source == cancelBtn) {
    uploadDialog.dispose();
    else if (source == addFileBtn) {
    File[] selFiles;
    String pathStr, nameStr;
    selFiles= fc.getSelectedFiles();
    for (int i=0; i<selFiles.length; i++) {
    if (selFiles[i].isFile()) {
    pathStr= selFiles[i].toString();
    nameStr= selFiles[i].getName();
    if (!fileListModel.contains(pathStr)) {
    fileListModel.addElement(pathStr);
    fc.setSelectedFiles(null);
    else if (source == delFileBtn) {
    int[] selectedIndices= fileList.getSelectedIndices();
    for (int i=selectedIndices.length-1; i>=0; i--) {
    fileListModel.removeElementAt(selectedIndices[i]);
    } catch (Exception aa) {
    System.out.println(aa);

  • Java.io.FilePermission weirdness

    Hi;
    I have set java.policy as:
         permission java.io.FilePermission "/windows/fonts/*", "read";
         permission java.io.FilePermission "\\windows\\fonts\\*", "read";
         permission java.io.FilePermission "c:/windows/fonts/*", "read";
         permission java.io.FilePermission "c:\\windows\\fonts\\*", "read";
    And yet I still get:
    java.security.AccessControlException: access denied (java.io.FilePermission c:\windows\fonts read)
    at java.security.AccessControlContext.checkPermission(AccessControlConte
    xt.java:270)
    at java.security.AccessController.checkPermission(AccessController.java:
    401)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
    at java.lang.SecurityManager.checkRead(SecurityManager.java:887)
    at java.io.File.list(File.java:904)
    at java.io.File.list(File.java:937)
    at net.windward.util.RegisterFonts.registerFonts(RegisterFonts.java:102)
    The one thing that is unusual - there is no c:\windows\fonts directory on my computer. (I have c:\winnt\fonts). But I should still be able to try a read to see if anything is there.
    Any ideas?
    thanks - dave

    And the answer is "c:/windows/fonts/*" is the files in that directory while "c:/windows/fonts" is being able to do a dir of the directory.

  • Wildcards and java.io.FilePermission???

    I realize I can use a "-" or "*" at the end of my pathname. Can I use one in the middle?
    I have approximately 1,200 user webs that I'd like to enable for JSPs with Jakarta Tomcat. I'd like each user to have write access to a /webdata folder withing their web:
    permission java.io.FilePermission "d:\\Inetpub\\Wwwroot\\dev\\jtest\\students\\-\\webdata\\-", "read, write";
    The directory name between students and webdata will be different for each student. Howdo I handle a varying directory name in the middle of the path?
    Any suggestions?

    You realize that you can use wildcards with FilePermission.
    Did you really test it for let's say one user, like:
    grant codeBase "file:${catalina.home}/webapps/examples/-" {
    permission java.io.FilePermission "d:\\somepath\\-", "read, write";
    Because I never succeeded in using wildcard with FilePermission.
    Wildcards work well for PropertyPermission.
    Dany
    [email protected]

  • Java.security.AccessControlException: access denied (java.io.FilePermission

    Hi,
    I have written swing code using applets.The code is::
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class JButtonDemo extends JApplet implements ActionListener{
    JTextField jtf;
    public void init(){
    Container c = getContentPane();
    c.setLayout(new FlowLayout());
    ImageIcon ii = new ImageIcon("");
    JButton but = new JButton(ii);
    but.setActionCommand("myButton");
    but.addActionListener(this);
    c.add(but);
    jtf = new JTextField(10);
    c.add(jtf);
    public void actionPerformed(ActionEvent ae){
    jtf.setText(ae.getActionCommand());
    The html is::
    <html>
    <body>
    <applet code="JButtonDemo.class" width="250" height="150">
    </applet
    >
    </body>
    </html>
    Its getting compiled but when I'm trying to run it like..
    appletviewer JButtonDemo.html
    its throwing the following error ..
    java.security.AccessControlException: access denied (java.io.FilePermission read)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269)
    at java.security.AccessController.checkPermission(AccessController.java:401)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
    at java.lang.SecurityManager.checkRead(SecurityManager.java:863)
    at sun.awt.SunToolkit.getImageFromHash(SunToolkit.java:472)
    at sun.awt.SunToolkit.getImage(SunToolkit.java:486)
    at javax.swing.ImageIcon.<init>(ImageIcon.java:81)
    at javax.swing.ImageIcon.<init>(ImageIcon.java:107)
    at JButtonDemo.init(JButtonDemo.java:10)
    at sun.applet.AppletPanel.run(AppletPanel.java:353)
    at java.lang.Thread.run(Thread.java:534)
    could anyone pls help me in rectifying this problem...
    Thanks in advance
    Srinivas

    You must have missed something, here is how I got it to work:
    appelt in c:\temp\test.java:import java.awt.Container;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.ImageIcon;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JTextField;
    public class test extends JApplet implements ActionListener {
         JTextField jtf;
         public void init() {
              Container c = getContentPane();
              c.setLayout(new FlowLayout());
              ImageIcon ii = new ImageIcon("c:/test.jpg");
              JButton but = new JButton(ii);
              but.setActionCommand("myButton");
              but.addActionListener(this);
              c.add(but);
              jtf = new JTextField(10);
              c.add(jtf);
         public void actionPerformed(ActionEvent ae) {
              jtf.setText(ae.getActionCommand());
    }html file in c:\temp:<DIV id="lblOutputText">Output comes here</DIV>
    <object
        classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
        codebase = "http://java.sun.com/update/1.5.0/jinstall-1_5-windows-i586.cab"
        >
        <PARAM NAME = CODE VALUE = test >
        <PARAM NAME = ARCHIVE VALUE = sTest.jar >
        <param name = "type" value = "application/x-java-applet">
        <param name = "scriptable" value = "false">
        <comment>
         <embed
                type = "application/x-java-applet" \
                CODE = test \
                ARCHIVE = sTest.jar
             scriptable = false
             pluginspage = "http://java.sun.com/products/plugin/index.html#download">
             <noembed>
                </noembed>
         </embed>
        </comment>
    </object>The batch file creating the signed jar in c:\temp\sign.batdel *.cer
    del *.com
    del *.jar
    del *.class
    javac test.java
    keytool -genkey -keystore harm.com -keyalg rsa -dname "CN=Harm Meijer, OU=Technology, O=org, L=Amsterdam, ST=, C=NL" -alias harm -validity 3600 -keypass password -storepass password
    rem keytool -export -alias harm -file exportPublicKey.cer -keystore harm.com -storepass password
    jar cf0 test.jar test.class
    jarsigner -keystore harm.com -storepass password -keypass password -signedjar sTest.jar test.jar harm
    del *.class
    pause

  • Runtime.getRuntime().exec() and java.io.FilePermission

    Hi all.
    I'm trying to run the following code, in an JSP file, inside an Tomcat installation, with Security Manager activated:
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec("arp -n -a");But, when I run the JSP, I receive the following error:
    java.security.AccessControlException: access denied (java.io.FilePermission <> execute)I have the following config. file:
    grant {
      permission java.io.FilePermission "/etc/intranet/intranet.properties", "read";
      permission java.io.FilePermission "/home/projetos/Shofar/conf/ShofarParameters.xml", "read";
      permission java.io.FilePermission "arp", "execute";
      permission java.net.SocketPermission "*:5432",   "accept,connect";
      permission java.lang.RuntimePermission  "selectorProvider";
      permission java.util.PropertyPermission "dns.server",        "read";
      permission java.util.PropertyPermission "dns.search",        "read";
      permission java.net.SocketPermission    "*",                 "resolve";
      permission java.net.SocketPermission    "*:53",              "accept,connect,resolve";
      permission java.io.FilePermission       "/etc/resolv.conf",  "read";
      permission java.net.SocketPermission        "127.0.0.1:465",                                                     "resolve,connect";
      permission java.util.PropertyPermission     "user.name",                                                         "read";
      permission java.io.FilePermission           "/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/javamail.providers",   "read";
      permission java.io.FilePermission           "/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/javamail.address.map", "read";
      permission java.security.SecurityPermission "insertProvider.SunJSSE";
      permission java.util.logging.LoggingPermission "control";
      permission java.util.PropertyPermission "java.awt.headless", "read";
      permission java.io.FilePermission "/tmp/-",                  "read,write,delete";
      permission java.io.FilePermission "/var/lib/tomcat5/temp",   "read";
      permission java.io.FilePermission "/var/lib/tomcat5/temp/-", "read,write,delete";
      permission java.io.FilePermission "/var/lib/tomcat5/work/-", "read,write,delete";
      permission java.util.PropertyPermission "java.io.tmpdir",    "read,write";
      permission java.lang.RuntimePermission "accessClassInPackage.sun.util.calendar";
      permission java.lang.RuntimePermission "accessDeclaredMembers";
      permission java.lang.RuntimePermission "suppressAccessChecks";
      permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper";
      permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
    };As seen, I put the permission java.io.FilePermission "/usr/sbin/arp", "execute"; line, but it don't work.
    What I need to put in the file?

    paulcw is right on the money on that one. You can easily create a bat file to perform that operation for you. However if you are feeling a little adventurous you can always use a Process:
    Process process=Runtime.getRuntime().exec(.....);
    int oneChar;
    InputStream inputStream=process.getInputStream();
    File file=new File("test.txt");
    try{
    file.createNewFile();
    } catch (Exception e){}
    FileOutputStream outputStream=new FileOutputStream(file);
    while ((oneChar=inputStream.read())!=-1){
    outputStream.write(oneChar);

  • Overriding java.io.FilePermission " ALL FILES "

    Hi all,
    By default, my application server (SJSAS 8.2 PE) has this configuration for files:
    permission java.io.FilePermission  "<<ALL FILES>>", "read,write";I'd like to restrict access to a specific file, but wouldn't like to change <<ALL FILES>> configuration, because it affects the deploy. To sum up, I'd like to remove a specific file form the security list (adding a new permission entry?).
    Is there a way to do this?
    Thanks in advance,
    Andre

    I'd like to restrict access to a specific file, but wouldn't like to change <<ALL FILES>> configurationYou have to.
    I'd like to remove a specific file form the security list (adding a new permission entry?).You can't do that. You have to remove the ALL FILES and list the files or directories that you want to grant access to, including whatever the deployment needs.

  • 'SYS:java.io.FilePermission' from scott

    Hi all,
    I want to assign Java permisiions from Scott users only.
    How can i achive this.Is it possiable.If yes please send the procedure to do that.
    I need like:*****************************************************************************
    ex : conn scott/tiger@xxxxx
    call dbms_java.grant_permission 'SCOTT','SYS:java.io.FilePermission', '\\\\Ntws212\\D\\AA\\%s.tif', 'write'
    Presently it is happening by Sys/manager.
    This will help me a lot in my C++ program.
    Thanks in advance,
    Kishore

    Hi Kishore,
    You can grant Java privileges to SCOTT using this statement:
    grant javasyspriv to SCOTT;
    And read/write file permissions using dbms_java.grant_permission procedure like this:
    CALL dbms_java.grant_permission('SCOTT', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'read,write'); - to read/write all files on your machine
    Those permissions will be assigned to SCOTT user only.
    Regards,
    Andrejus

  • Java.io.FilePermission read error

    I was wondering if anyone can help me or point me to the right direction in terms of accessing a file (Brucella.xml) using an applet.
    Within my applet.html located in my build folder, I have indicated a dataLocation variable to be passed into the applet.java file. I have tried signing the jars that is used by the application using keytool -genkey and -jarsigner, and I tried placing the xml file in a jar (pronetSample.jar), placing this jar in the build directory, and signing it, but it didn't seem to work.
    <param name="DataLocation" value="pronetSample/Brucella.xml">I also tried putting the Brucella.xml in the build directory and called it directly in the html and got the same error
    <param name="DataLocation" value="Brucella.xml">Next, I tried placing the file on the web and accessing http://staff.vbi.vt.edu/chlee/Brucella.xml but still received the same error message.
    <param name="DataLocation" value="http://staff.vbi.vt.edu/chlee/Brucella.xml">Perhaps, I may be accessing it incorrectly? (wrong path syntax) By the way, the applet works if I were to go in and change my java policy file, but I'd like to avoid this so that end users will only need to do as little as possible to get the applet to run. I'm not sure what I'm doing wrong, but any help would be much appreciated. Thanks.

    any insightful feedback would be great. thanks

Maybe you are looking for

  • Raid array removed, hard drives now wont work?? help

    Hi all, I had a KT266 pro2RU motherobard with 2 ibm 40gig hard drives that were in raid mode 0, I took the 2 drives out of the computer and wanted to use one of them in another computer on a standard drive controller (single drive not raid) and i can

  • Need fcc configuration on receiver file adapter

    Hi, I am working on file to file scenario using fcc. My source file is picking propely in sxmb_moni its showing properly. but output file is not placing in target directory. My output record structure iss Target..1.1(nodE)    detail     0..unbounded

  • INT function in VB6

    Hello, I am not sure that  this is the correct place to put VB6 question or not, If not please suggest me correct one. My Question: Can any one explain me how INT function works internally for double type data in below case? Eg.  Dim dblVal as Double

  • How do I get custom ringtones on my wife's phone?

    My wife just had to get a pantech crux because she started to text because of a new grandchild.  I would love to be able to get "our song" on the crux as a surprise, but have not been able to do it.  I have spent hours searching for a solution on the

  • Missing features in iWork 08

    I'm a recent convert to Mac Pro from high-end Dell Workstations. I downloaded the free trial of iWork 08, and was extremely impressed with the relative ease of use of Pages & Numbers compared with Word & Excel. It could be a real MS "Office Killer."