views:

595

answers:

4

I have a .war file of a Java Web Application. Now I want to upload it to my ftp server so that I can execute it.

What steps I should perform to run it?

The context path of the webapp is /mywebapp

Edit:

Actually, my ftp server name is ftp://bilgin.ath.cx/ and I have uploaded my "TestWebApp.war" file to this dir: ftp://bilgin.ath.cx/web

Then what should be the URL to access the index.html page of the webapplication

============================================edited=================================================

tomcat is listening on 8082

apache access tomcat with jk connector

+1  A: 

The tomcat manual says:

Copy the web application archive file into directory $CATALINA_HOME/webapps/. When Tomcat is started, it will automatically expand the web application archive file into its unpacked form, and execute the application that way.

tangens
after uploading it to the webapps directory, what URL should I enter in the browser to access it index.html page........ I am new to J2EE
Yatendra Goel
It should work using `http://localhost:8080/mywebapp`
tangens
btw, tomcat 4 is outdated ;) (the above statement is still correct for 6)
Bozho
Please have a look at the edited question.
Yatendra Goel
+1  A: 

Note that you can deploy remotely using HTTP.

http://localhost:8080/manager/deploy

Upload the web application archive (WAR) file that is specified as the request data in this HTTP PUT request, install it into the appBase directory of our corresponding virtual host, and start it using the war file name without the .war extension as the path. The application can later be undeployed (and the corresponding application directory removed) by use of the /undeploy. To deploy the ROOT web application (the application with a context path of "/"), name the war ROOT.war.

and if you're using Ant you can do this using Tomcat Ant tasks (perhaps following a successful build).

To determine which path you then hit on your browser, you need to know the port Tomcat is running on, the context and your servlet path. See here for more details.

Brian Agnew
Please have a look at the edited question.
Yatendra Goel
Your FTP location (as listed in your question) is largely meaningless in this context. What's the port number that Tomcat is running on, what's your servlet name and what's your context name ? These go to make up the path that you request in your browser. See my edit above.
Brian Agnew
Secondly, does FTPing it result in a deployment ? You need to write to the correct directory and then check your log files.
Brian Agnew
+2  A: 
  • copy the .war file in the webapps folder
  • upload the file using the manager application - http://host:port/manager. You will have to setup some users beforehand.
  • (not recommended, but working) - manually extract the .war file as a .zip archive and place the extracted files in webapps/webappname

Sometimes administrators configure tomcat so that war files are deployed outside the tomcat folder. Even in that case:

After you have it deployed (check the /logs dir for any problems), it should be accessible via: http://host:port/yourwebappname/. So in your case, one of those:

http://bilgin.ath.cx/TestWebApp/
http://bilgin.ath.cx:8080/TestWebApp/

If you don't manage by doing the above and googling - turn to your support. There might be an alternative port, or there might be something wrong with the application (and therefore in the logs)

Bozho
Please have a look at the edited question.
Yatendra Goel
and you have a look at the updated answer ;)
Bozho
+2  A: 

As others pointed out, the most straightforward way to deploy a WAR is to copy it to the webapps of the Tomcat install. Another option would be to use the manager application if it is installed (this is not always the case), if it's properly configured (i.e. if you have the credentials of a user assigned to the appropriate group) and if it you can access it over an insecure network like Internet (but this is very unlikely and you didn't mention any VPN access). So this leaves you with the webappdirectory.

Now, if Tomcat is installed and running on bilgin.ath.cx (as this is the machine where you uploaded the files), I noticed that Apache is listening to port 80 on that machien so I would bet that Tomcat is not directly exposed and that requests have to go through Apache. In that case, I think that deploying a new webapp and making it visible to the Internet will involve the edit of Apache configuration files (mod_jk?, mod_proxy?). You should either give us more details or discuss this with your hosting provider.

Update: As expected, the bilgin.ath.cx is using Apache Tomcat + Apache HTTPD + mod_jk. The configuration usually involves two files: the worker.properties file to configure the workers and the httpd.conf for Apache. Now, without seeing the current configuration, it's not easy to give a definitive answer but, basically, you may have to add a JkMount directive in Apache httpd.conf for your new webapp1. Refer to the mod_jk documentation, it has a simple configuration example. Note that modifying httpd.conf will require access to (obviously) and proper rights and that you'll have to restart Apache after the modifications.

1 I don't think you'll need to define a new worker if you are deploying to an already used Tomcat instance, especially if this sounds like Chinese for you :)

Pascal Thivent
@Pascal: I can give you the username and password of the ftp site bilgin.ath.cx Kindly reply me so that I can give you username and password at that time and after few minutes, will delete it so that no other person can see it in future.
Yatendra Goel
@Yatendra I really do **not** recommend to put sensible information on a public website, even for a short time period. And you shouldn't give access to sensible resources to someone you don't know, even if I'm actually a nice guy :)
Pascal Thivent
@Pascal: ok.. so could you please tell me what changes I need to do.. Actually, the web app is developed by me and is running fine on my localhost.. now I have to load it on my client's ftp server (bilgin.ath.cx)... but I don't know how to configure apache server so that it can automatically unzip my .war file and run it
Yatendra Goel
@Pascal I have edited my question
Yatendra Goel