77

I noticed that in my JBoss Application Server 7 installation under standalone/tmp I have 400 MB of files related to past deployments, some of them a few months old.

How is it cleaned up? Should it happen automatically? Is there a tool for it? Can I just remove all those files myself?

davidryan
  • 2,222
  • 20
  • 31
Konrad Garus
  • 53,145
  • 43
  • 157
  • 230
  • 1
    see http://stackoverflow.com/questions/3015177/to-clean-or-not-to-clean-jboss-home-server-web-tmp-directory – gavenkoa Nov 20 '12 at 08:31

3 Answers3

122

As you know JBoss is a purely filesystem based installation. To install you simply unzip a file and thats it. Once you install a certain folder structure is created by default and as you run the JBoss instance for the first time, it creates additional folders for runtime operation. For comparison here is the structure of JBoss AS 7 before and after you start for the first time

Before

jboss-as-7
 |
 |---> standalone
 |      |----> lib
 |      |----> configuration
 |      |----> deployments
 |      
 |---> domain
 |....
 

After

jboss-as-7
     |
     |---> standalone
     |      |----> lib
     |      |----> configuration
     |      |----> deployments
     |      |----> tmp
     |      |----> data
     |      |----> log
     |      
     |---> domain
     |....

As you can see 3 new folders are created (log, data & tmp). These folders can all be deleted without effecting the application deployed in deployments folder unless your application generated Data that's stored in those folders. In development, its ok to delete all these 3 new folders assuming you don't have any need for the logs and data stored in "data" directory.

For production, ITS NOT RECOMMENDED to delete these folders as there maybe application generated data that stores certain state of the application. For ex, in the data folder, the appserver can save critical Tx rollback logs. So contact your JBoss Administrator if you need to delete those folders for any reason in production.

starball
  • 20,030
  • 7
  • 43
  • 238
uaarkoti
  • 3,659
  • 2
  • 20
  • 23
  • 10
    Why is it not recommended to delete the `tmp` or `work` folder on Production? I would be grateful if you can explain or point to some link regarding this. Thanks – Prakash K Sep 12 '12 at 10:06
  • 2
    After deleting those 3 folders, in standalone.xml data should be removed. – jacktrades Oct 29 '12 at 15:08
  • *data* folder also big. But delete it,You have to redeploy all applications. Does someone know how to remove the *data* folder in efficiency way? – vanduc1102 Jan 04 '16 at 03:05
  • If you don't want to deploy everything again (possibly because some old JSP file is still being referenced), just delete `tmp`. – dvlcube Mar 17 '17 at 20:44
  • https://stackoverflow.com/questions/68179420/can-we-delete-content-from-jbpm-standalone-tmp-vfs-folder-in-wildfly-14 - Can anyone help here. May be i am having same issue. – Neha Jun 30 '21 at 04:44
19

Files related for deployment (and others temporary items) are created in standalone/tmp/vfs (Virtual File System). You may add a policy at startup for evicting temporary files :

-Djboss.vfs.cache=org.jboss.virtual.plugins.cache.IterableTimedVFSCache 
-Djboss.vfs.cache.TimedPolicyCaching.lifetime=1440
skay
  • 1,681
  • 1
  • 14
  • 13
5

I do not have experience with version 7 of JBoss but with 5 I often had issues when redeploying apps which went away when I cleaned the work and tmp folder. I wrote a script for that which was executed everytime the server shut down. Maybe executing it before startup is better considering abnormal shutdowns (which weren't uncommon with Jboss 5 :))

nansen
  • 2,912
  • 1
  • 20
  • 33
  • wat was the script doing? I work with JBoss 5 and experience the same problem. Thank you. – lrl Aug 04 '14 at 13:48
  • It just did a 'rm -rf' on all contents of tmp and work directories. You could actually delete the whole tmp directory. Jboss will recreate it at the next startup. – nansen Aug 11 '14 at 10:23