java.io.FilePermission
this exception always thrown when I am trying to run my code using tahiti server that i am developing java mobile agent

Dani AI

Generated

Good catch by and a solid prompt from to get a stack trace — permission errors are usually resolved by checking class/package layout first and then the security policy.

Checklist to avoid java.io.FilePermission with Tahiti/Aglets

  • Make sure the class is declared in a package (use the lowercase package keyword) and that the package name exactly matches the folder structure under the server’s public codebase.
  • The compiled .class (or JAR) must be placed under the public codebase in the same path as the package.
  • When instantiating an aglet, provide the aglet’s fully qualified class name (package + class). On Unix-like systems names are case-sensitive — match case exactly.
  • The aglet class should be public and its filename must match the public class name.

If the FilePermission still appears

  • Inspect the server-side stack trace to see which component attempted file I/O. That tells whether it was the classloader, the aglet code, or your own code being blocked.
  • If the SecurityManager is blocking legitimate reads from the public directory, grant read permission in the server’s policy file and restart Tahiti. Example (replace the path with your server public path):
grant {
  permission java.io.FilePermission "/path/to/tahiti/public/-", "read";
};

Quick debugging tips

  • Try a minimal public aglet in a simple package to verify the server can instantiate it, then move to your real package.
  • Avoid the default package for anything the server must load.
  • When reopening the issue, include the exact stack trace and server log lines so helpers can see whether the problem is classloading vs. security policy.

Recommended Answers

All 3 Replies

There must be reason why that error is thrown.

Please post relevant code and do not forget include stack trace of error

Thank you very much I found the error

AgletProxy p;  //line 1
p=getAgletContext().createAglet(getCodeBase(),"child",null); //line 2

line2 is the error and correction is

AgletProxy p;  //line 1
p=getAgletContext().createAglet(getCodeBase(),
"examples.folder1.child",null);          //line 2

where in windows OS
C:\aglets-2.0.2\public\examples\folder1

and "folder1" contains java files I am developing

There must be reason why that error is thrown.

Please post relevant code and do not forget include stack trace of error

Thank you very much I found the error

AgletProxy p;  //line 1
p=getAgletContext().createAglet(getCodeBase(),"child",null); //line 2

line2 is the error and correction is

AgletProxy p;  //line 1
p=getAgletContext().createAglet(getCodeBase(),
"examples.folder1.child",null);          //line 2

where in windows OS
C:\aglets-2.0.2\public\examples\folder1

and "folder1" contains java files I am developing

Thank you very Much Peter you are so gentle
I have a problem in the package that the correct syntax is

Package examples.folder1;

examples is a folder appears after installation of Tahiti server
folder1 : the Folder I created to create java files inside it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.