0

Im teaching myself servlets, found some very good tutorials and have great success in Eclipse Neon EE. (very basic servlet that just serves a simple static web page)

I installed Tomcat standalone before installing Eclipse Neon EE, and tested it and I get the regulat apache tomcat page. The tutorials I found also guided me on how to set up the tomcat server in Eclipse. They also showed me how to create a project and servlet. Even though I use 3.1, I still have Eclipse create the web.xml file.

When I run my servlet, Eclipse starts up Tomcat and does everything, and opens a browser tab within Eclipse and it takes me to http://127.0.01:9999/first/Hello and it serves up my web page. No problem. So now I export my project as WAR file, tell Eclipse to put the .war file right in my tomcat8's ROOT dir. Then i stop the tomcat8 server in eclipse and shut down eclipse. Then I use startup.bat and tomcat comes up, but then I cannot surf to http://127.0.01:9999/first/Hello from this same PC, it just gives 404 with "The origin server did not find a current representation for the target resource or is not willing to disclose that one exists."

Im not quite sure what steps I am missing?

Optical Carrier
  • 368
  • 1
  • 4
  • 14
  • War files must go to the webapps dir. Not to the ROOT dir. ROOT is just one of the deployed webapps. https://tomcat.apache.org/tomcat-8.5-doc/appdev/deployment.html#Deployment_With_Tomcat – JB Nizet Jun 28 '17 at 22:16
  • Check this URL first http://127.0.01:9999/ if it shows project deployed in tomcat console.War needs to to webapps folder to be accessible to application server – Shivam Aggarwal Jun 29 '17 at 06:09

1 Answers1

0

You have to put your war file (first.war) into the "webapps" subdirectory, not into the root Folder of your tomcat server. Have a look at : How to deploy a war file in Tomcat 7

Copy the .war file (first.war) to %CATALINA_HOME%\webapps ( E.g.: C:\tomcat\webapps )

Run %CATALINA_HOME%\bin\startup.bat

Your .war file will be extracted automatically to a folder that has the same name (without extension) (E.g.: hello)

...

Community
  • 1
  • 1
JFWenisch
  • 400
  • 1
  • 6