This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes write jboss service to perform a task at startup. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "write jboss service to perform a task at startup." Watch "write jboss service to perform a task at startup." New topic
Author

write jboss service to perform a task at startup.

sapna rana
Greenhorn

Joined: Sep 01, 2008
Posts: 18
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

Joined: Sep 08, 2008
Posts: 16
I think simple way is to write a Servlet to do this copy and set it to start on startup.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

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.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

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.


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: write jboss service to perform a task at startup.
 
Similar Threads
Incomplete deployment
File upload with struts
JAI -storing local copies
Submit HTML form Data thru Servlet
Jboss takes long to start up