0

My Upload script works fine (JSF 2 and Primefaces). I can upload, show in the web, insert filename to database but when I reboot the server, the files are gone !

I noticed that the deployed project store in the Jboss Temporary directory, so when you restart the server, the old deployed project will be deleted.

So, please give me the solution that I could keep all the file uploaded even I reboot the server

Thanks !

  • 1
    Related: http://stackoverflow.com/questions/6059453/how-to-provide-relative-path-in-file-class-to-upload-any-file and http://stackoverflow.com/questions/4548190/best-location-for-uploading-file – BalusC Jul 31 '11 at 11:38

2 Answers2

1

As their name indicates, the temp folder in Jboss is used internally by the server to uncompress the different project files (like .jar, .war, .ear...) and work directly with the files inside. You should never use the temp folder to store your uploaded files. Instead design another folder of the machine to store them and configure your application to upload the files there, so they will always be available

jasalguero
  • 4,142
  • 2
  • 31
  • 52
0

I've found the solution, very easy, just extract the .war or .ear folder and put it in the Jboss's deploy folder

For Example I have the project structure like this:

  • MySweetHome.ear
    • MySweetHome_Client.war
    • MySweetHome_EJB.jar

Now just extract 2 folders MySweetHome.ear and MySweetHome_Client.war by using Winrar and we have

  • MySweetHome.ear(folder)
    • MySweetHome_Client.war (folder)
    • MySweetHome_EJB.jar

And deploy with JBoss, now the uploaded images won't be wiped out by the server after rebooting !