Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

write jboss service to perform a task at startup.

 
sapna rana
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In my web application i have a option to upload images and the images are saved at two location one under the tmp folder in jboss(C:\jboss\server\default\tmp\deploy) and another under a folder (C:\jboss\vin_procure\images).
Now when we start jboss , tmp folder get overwrites and images are lost . So i need to write a jboss service in order to copy all the images under folder (C:\jboss\vin_procure\images) to the tmp folder in jboss.

Please suggest how can be write a jboss service or modify at

Thanks and Regards,
 
S Setty
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think simple way is to write a Servlet to do this copy and set it to start on startup.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also create a Jboss SAR (Service Archive) which basically consists of a jboss-service.xml file (which states what services to start) and the EJBs/Pojos/whatever that do the actual work.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are other options.

First option: you could set up an external directory so that the images are accessed directly.

Second option: you could deploy your war as an exploded directory. The images would then not be copied to the tmp directory, and also not be removed on restart.

Both of these would be better options than copying files on startup.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic