3 Replies Latest reply: Apr 9, 2012 2:33 PM by Peter Johnson RSS

JBoss 5.1 and tmp folder

bauerpl Newbie

Hi everyone,


I've a problem with my project. I need create xml file in /WEB-INF/ when user login.

JBoss create this file in own /tmp directory eg. /home/jboss/server/default/tmp/555-332-432-1-29v/ProjectName/WEB-INF/file.xml but file exist there only few seconds.

It is possible to disable deleting file from tmp folder or set specific path in tmp folder (eg. WEB-INF/usersfiles) where files will be exists all the time or during to restart?


Thanks for help

and sorry for my english


Best regards


  • 1. Re: JBoss 5.1 and tmp folder
    Peter Johnson Master

    Try deploying as an exploded app: https://community.jboss.org/wiki/ExplodedDeployment

    Then, the XML file will be created at server/xxx/deploy/yourapp.war/WEB-INF/xxx.xml and will survive a restart.

  • 2. Re: JBoss 5.1 and tmp folder
    bauerpl Newbie

    Yes i have like this but when i create file


    File file = new File(getSession().getServletContext().getRealPath("/WEB-INF/user.xml"));


    file is create in




    after few seconds JBoss remove this file (user.xml). I try with java.security.manager and server.policy but it does not work.


    Best regards


  • 3. Re: JBoss 5.1 and tmp folder
    Peter Johnson Master

    I just now tried it on one of my web apps, deployed it as exploded, and included the File creating line you posted. The I printed out file.getAbsolutePath and got this:


    file loc : D:\opt\jbia\work\jboss-5.1.0.GA\server\servlet\deploy\servlet.war\WEB-INF\user.xml


    Please describe exactly how you did the exploded deployment.