Results 1 to 6 of 6
  1. #1
    spunog is offline Member
    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Default Struts 2 PDF permissions error *Please help*

    Hi,
    Using tomcat 6 , struts 2.2.1.1 CENTOS
    I have an app that generates pdf's and EXcel files. I have separate dev/test/staging production environments. I use CentOS for everything except the dev.
    On the clients production machine I get a permissions error when creating the file. I assume its trying this in the tmp folder :

    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("document.pdf"));

    and then I send it to the stream like this :

    pdfStream = new FileInputStream("document.pdf");

    So on the production machine I get this exception in the catalina.out :

    document.pdf (Permission denied)
    java.io.FileNotFoundException: document.pdf (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.jav a:137)
    at java.io.FileInputStream.<init>(FileInputStream.jav a:96)


    AFter running getfacl I on the tmp folder I get this :


    # file: tmp/

    # owner: root

    # group: root

    # flags: --t

    user::rwx

    group::rwx

    other::rwx

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default Re: Struts 2 PDF permissions error *Please help*

    It will be writing that document to whatever is the root for the application.
    If you want the actual path you could try:
    Java Code:
    <whatever logger you have>.log(new File("document.pdf"));
    and see what you get on the client system.
    Please do not ask for code as refusal often offends.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default Re: Struts 2 PDF permissions error *Please help*

    Whoops, that shoudl say:

    Java Code:
    <whatever logger you have>.log(new File("document.pdf").getAbsolutePath());
    Please do not ask for code as refusal often offends.

  4. #4
    spunog is offline Member
    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Default Re: Struts 2 PDF permissions error *Please help*

    Hi Tolls, Thanks for your help.

    So that line outputed : /usr/share/tomcat6/document.pdf on my staging setup. So I guess I need to output this on the clients machine and get them to do a chmod 777 on the folder that pops up. Do you think there might be anything else also ?


    Thanks again.

  5. #5
    spunog is offline Member
    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Default Re: Struts 2 PDF permissions error *Please help*

    I changed the permissions on the testinbg machine to read only for that foilder. The error now matches the production one. So I guess that is a good indication.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    19

    Default Re: Struts 2 PDF permissions error *Please help*

    Sounds reasonable.
    I (personally) would suggest a property that can be set, so they can decide where to dump these files.
    Filling up the tomcat root with random files doesn't strike me as a long term solution, unless you are clearing these out at some point.
    Please do not ask for code as refusal often offends.

Similar Threads

  1. don't have permissions
    By Petr in forum Suggestions & Feedback
    Replies: 4
    Last Post: 06-12-2011, 04:38 PM
  2. Struts error.can anyone help me
    By murali23krishna in forum Web Frameworks
    Replies: 1
    Last Post: 06-27-2010, 04:13 AM
  3. Struts Error Please help me out
    By NareshP in forum Web Frameworks
    Replies: 1
    Last Post: 11-11-2008, 10:16 AM
  4. struts error....
    By rahaman.athiq in forum Web Frameworks
    Replies: 1
    Last Post: 11-06-2008, 07:18 AM
  5. struts error
    By sandor in forum Web Frameworks
    Replies: 3
    Last Post: 04-24-2007, 07:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •