Adding images to a running JBoss web application

We have a web application that allows users to upload photos which will then be displayed in a specified page after upload. The upload module places the images inside the exploded war directory, e.g. webapp-root/uploads/ such that once the image is uploaded, it can be viewed instantly, as in

This was working with one application server, but as it turns out, we were to deploy this app to 2 load-balanced servers. So I coded a quick file-sync module that syncs files between servers using FTP, whenever users upload images. Basically when a user uploads an image on server1/uploads/, I immediately copy it via FTP to server2/uploads/.

Edit (added upload process): The upload goes something like this:

  • User selects and submits image
  • Server saves file in server1/uploads/
  • Background thread does an FTP sync from server1 to server2/uploads/ (done async)
  • Vice versa for server2

At this point, I'm running into problems.

The url uses a hardware load balancer to point to either server1 or server2. If a user uploads an image test-image.png to server1 (which is then synced to server2), I assume that I can access the image through regardless of whether the load balancer directs me to server1 or server2.

This isn't the case however. Continuing with the example, an image uploaded when the domain is pointed to server1 can only be viewed when is redirected to server1, and it appears as a broken link if a second user accesses the same url but the load balancer directs him to server2.

So it seems like JBoss isn't refreshing the second server whenever I FTP-copy an image inside its war directory. Which is kind of weird since if I upload an image to server1, the JBoss instance on that server serves up the image file without any problems.

Any way to manually tell JBoss that "hey, we have a new image file here"?


I`m just wondering.... If it was the case that I was thinking in creating different reseases for each custumer that I sold my software, could I check each one with MD5 just changing a comment inside ...

Because codenameone can not use external libraries (HttpConnection) then I have to use the internal library / API provided Codenameone, it's just that I've managed to post the data to format text / ...

I have a Java 7 code, where I'm playing with MethodHanlde. The code is : import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; class ...

OSX apps have a Help menu on the right of the menu bar. When the Help menu is click, a menu opens with a search box at the top and a few menu items under it. How can this be achieved in a Java Swing ...