Java web application, file upload not happening in the server

We recently hosted a web application in an ubuntu server and found that file upload was not happening. After googling
for a while this is what we found.

1. Navigate to parent folder of the folder or directory created for storing uploaded images.
2. Enter command ls -lsh in terminal.
3. Check who is the owner of the directory of folder created. In case if you haven't created a folder please do it. and then do the checking.
4. Probably it will be root or the user with which you created the folder.
5. Go to the tomcat directory location and again type the ls -lsh command and see who owns the directories there?
6. If it is tomcat 6 version, the owner might be tomcat6 user and similary a tomcat user for other versions.
7. This difference is reason for the file upload not happening.
8. All you have to do is change the owner of the upload directory of folder to respective tomcat user. It should work fine from then.

How to host a java web application live?

When a tomcat 6 is used for a java struts2 web application. How do I access it by using a domain address?
say, when I type www.xyz.com, I wanted my application to come up. And I was using an Ubuntu server 12.04 LTS I think.

I am not really sure about what should be the right way to do it. However I have managed to get this done.

Before explaining that, I think below is one of the right method to implement.

http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html

The above site explanation was little tough for me to understand. So I tried other ways.

1. Inside tomcat webapps, there is a ROOT Folder with index.jsp file in it. I renamed the root folder to ROOTBKUP.

sudo mv ROOT ROOTBKUP

2. Then renamed my application's folder name inside webapps to ROOT folder.

sudo mv xyz ROOT

3. Now if you already set up your firewall, then you will need to allow incoming connections from 80, 8080, 443, 8443

iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT

iptables -A INPUT -i eth0 -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 8443 -j ACCEPT

4. After allowing incoming connections thru above ports, then you need to redirect the connections coming to 80 to 8080 and
similarly 443 to 8443

iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8443

5. You may restart the tomcat server now.

This would work only if you are planning for hosting only one application in a server according to me. People
with more expertize in this area should be able to guide you guys for multiple hosting.

Good luck! :)