0

I am new to java web programming and eclipse-apache Tomcat. I have small login web-application which includes (one jsp page , one servlet class).

I want to configure/deploy this application on apache web application manager. I mean I don't want to run this application in eclipse. I hope you understand my point.

Whenever I run my server in eclipse it run successfully. But when I want to open apache default page by typing http://localhost:8080 or http://localhost:8080 to configure my app It wouldn't open.

Please advice me.

Maverick
  • 173
  • 4
  • 10
  • so you are not able to deploy your application or you are not able to run tomcat itself. first your need to run tomcat and make sure http://localhost:8080 works. then only youy can think of deploying ur application. – ppuskar Feb 11 '15 at 03:47
  • I am able to run the tomcat server in eclipse server tab. But unable to run in the browser localhost:8080. When I try to run in the browser blank page appear with Directory listing heading. – Maverick Feb 11 '15 at 04:06
  • i think you should do this independent of your eclipse, first configure TOMCAT at your workstation which will require you to download tomcat then you can go ahead and search how to deploy web-app in tomcat. – ppuskar Feb 11 '15 at 04:13
  • or you can follow the step i provided in one of the answers ! – ppuskar Feb 11 '15 at 04:39

3 Answers3

0

To deploy a web application on Tomcat, you need to first compile your web application into a WAR file. Then, take that WAR file (let's assume it's called "MyApp.WAR") and put that into the tomcat/webapps directory. Restart the tomcat service. Tomcat will extract that WAR to a folder in the webapps directory. After that, any request to localhost:8080/MyApp will go to your webapp.

chairbender
  • 839
  • 6
  • 14
0

Make sure you have java installed, and add JAVA_HOME to your environment variable. (it is the path to java installation directory for e.g. C:\Program Files\java\jdk-1.6) i.e JAVA_HOME=C:\Program Files\java\jdk-1.6

install TOMCAT from here "http://tomcat.apache.org/download-70.cgi" make sure you do not install it in you "c:\program files" due to some permission issues.

Lets say you installed tomcat at "c:\webserver\apache-tomcat\" this is your CATALINA_HOME, add it to your environment variable i.e CATALINA_HOME=c:\webserver\apache-tomcat\

to acess tomcat webapp manager you need to configure user in %CATALINA_HOME%\conf\tomcat-users.xml Add a role and a user :

Have your WAR file ready with you (this is how you create WAR "How to make war file in Eclipse")

move your WAR file to "%CATALINA_HOME%\webapp" directory. lets say "TestWeb.WAR" is your application with index.jsp page in it.

Now go to your %CALALINA_HOME%\bin and launch the startup.bat file (you would be using startup.bat to start and shutdown.bat to stop tomcat)

once tomcat is up and running check http://localhost:8080 is working fine. P.S. If port 80 is already in use then try configuring your tomcat to some other unused PORT here "http://www.mkyong.com/tomcat/how-to-change-tomcat-default-port/"

go to your browser type http://localhost:8080/TestWeb/index.jsp

now you can to lot of configuration to your web app like having a default page and all Hope this help you !

Community
  • 1
  • 1
ppuskar
  • 773
  • 6
  • 9
  • I tried everything you mentioned but haven't succeeded yet. But one thing i noticed, I couldn't restart tomcat server from the batch file then I went to server tab in eclipse and restarted the tomcat server. – Maverick Feb 11 '15 at 07:22
  • End result so far, i typed in my browser http://localhost:80 [tomcat server status started in eclipse] blank page appear with heading at the top of the page "Directory Listing For / – Maverick Feb 11 '15 at 07:24
  • either use tomcat through eclipse or tomcat which you installed as a separate entity reason being there is a thing called PORT(80 in our case) which will be either locked by tomcat in your eclipse or the another installation. – ppuskar Feb 11 '15 at 08:18
  • i have a doub't regarding about one thing. can you provide the image of directory listing page. – ppuskar Feb 11 '15 at 08:22
  • ppuskar please see my above uploaded image – Maverick Feb 11 '15 at 21:14
  • I have uploaded the image of my apache tomcat location. Just after the submission I got message that it require moderator permission. Since then nothing happen – Maverick Feb 13 '15 at 03:45
  • sorry but i cannot see any image. i hope you tried with separate tomcat installation without eclipse. – ppuskar Feb 13 '15 at 05:13
0

Normally eclipse uses Tomcat as an eclipse project, hence it uses metadata.

Server > Double click on the tomcat server instance > Server Location > Select "Use Tomcat installation"

enter image description here

Update: Tested just now. Set Deploy path to webapps folder. Works fine :)

enter image description here

sura2k
  • 7,365
  • 13
  • 61
  • 80
  • sura2k, I tried it multiple times but it didn't work out. Even these options are disable in my eclipse. To make them enable I first deleted my project from server list then selected the option 'use tomcat installation(take control of tomcat installation) and saved. I remember it worked very first time and I opened the localhost:80 page and went into manage app option. Since then i dont know what happened that this page is not appearing and again all these options [mentioned in your image got disables again and "use workspace metadata option " selected again. – Maverick Feb 11 '15 at 05:12
  • You need to set the `Deploy path`. Otherwise manager won't run. Updated the answer. – sura2k Feb 11 '15 at 07:12
  • I pointed it to webapps folder my system path is "C:\apache-tomcat-7.0.34\webapps". Still nothing happen. I also tried to point it to my required project – Maverick Feb 11 '15 at 07:41