3 Replies Latest reply on Feb 16, 2004 2:57 PM by André Santos Oliveira

    Policy File in method EJB Container

    André Santos Oliveira Newbie

      How I do for my container EJB not write a file in any directory (c:\temp) ?

      My Policy File:

      grant codeBase "file:/C:/JBoss/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/EAR1.ear/EJB1.jar" {
      // Allow everything for now
      permission java.io.FilePermission "c:\\temp\\test.txt", "read,write";
      };

      My method in SessionBean:

      public String getMensagem() throws IOException, RemoteException{
      File file = new File("c:" + File.separator + "temp","testEJB.txt");
      File file2 = new File("c:" + File.separator + "temp2","testEJB2.txt");
      file.createNewFile();
      file2.createNewFile();
      file.delete();
      file2.delete();
      return "Test policy file";
      }

      This is code must throws SecurityException, or mustn't?

      Can you help me?

      Thank you.
      Andre