views:

1107

answers:

5

Hey,

I am trying to use tomcat with eclipse. I have installed it all and got the tomcat plugin installed. I have put a .war file in the webapps folder of tomcat and have made sure autodeploy is set to true. The problem I am having is that I can't get tomcat to run this .war file. The tomcat server is started and running as it tells me under the servers tab at the bottom of eclipse. It also shows the name of my .war file under it and says synchronized meaning it at least knows its there. But I can't get it to work at all. Even when I go to the local host page it shows the title of apache tomcat but does not show the file. I want it to show me the .war file. It has the correct xml files and everything in it. Any help is much appreciated.

+1  A: 

You may try to check whether the application is deployed or not. You can directly go to the Tomcat directory to see this.

Another possible thing could be, you might be typing the incorrect url. http://localhost:8080/[your_application]

where 8080 is the port you have specified for tomcat.

Rakesh Juyal
What do you mean? I have tried 8080 and it gives the usual page doesn't exist error. When I try the url you have given but without the 8080, It take me to a page that has a header saying tomcat but doesn't actually have anything there for me to open.
A: 

If for some reason your webapp failed to initialize properly (error in the descriptor, an uncaught exception in a context listener, ...) tomcat will unload it and you won't see anything at http://localhost:8080/yourwebapp.

Luca Tettamanti
A: 

Start tomcat from the command line (not eclipse) and see if your webapp shows up. It should if you have indeed created a valid war file. If it doesn't work, check the logs.

You shouldn't be manually deploying the war file if you are using eclipse to launch tomcat. Running tomcat from eclipse does not necessarily use the same default workspace as the standalone tomcat. Check the configurations for the 'server': it may be that the eclipse launched server's webapp folder is empty.

+2  A: 

You need to let Eclipse publish your web project for you when using the Eclipse Tomcat plugin instead of trying to manually deploy it youself.

The Tomcat plugin for Eclipe supports hot deployment whereby you can change jsp's etc without having to manually redeploy your web application.

If you have a valid web project in eclipse then you can check that it is being deployed by looking at the Server View.

Window, Show View, Other, Server

This window should contain details of your Apache server. (If no server is listed then you'll need to right click on the list and set one up.)

To check that your application is being deployed right click on your server and select Add/Remove projects. Check that your web project is listed. If it is not listed under Configured Project then add it.

If your project does not appear in the list then it probably wasn't setup as a Dynamic Web Project. You can fix this by by right clicking on the project to bring up project properties and then clicking on facets and then enabling Dynamic Web Project.

It is also worth having the Console view visible when starting/stopping Tomcat so that you can see the server output.

pjp
A: 

Is it there in the list of applications in tomcat manager? if you havent done this...then follow the steps... Go to http://localhost:8080/ Go to Tomcat manager and check if your application is there in the list of deployed applications. Try redeploying or starting the application if running=false. It usually tells you what is wrong when you do that.

Sandeep Rajeev