• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How to run a .war webapp created with Ant ?

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear community,

I am following the course ‘Learn Maven and Ant’ on Udemy.

A test project consist of building a webapplication that adds two numbers. The build AddTestProj.war is deployed to oddly named directory ${env.CATALINA_HOME}\webapps.

Then the teacher wonders whether it will work. He happens to have it running already and apparently it works. He provides however no explanation on how to make it run.

He shows it running in an unidentified program that shows the following url : 124.0.0.1:8080/AntTestProj/AddTwoNumbers.html.

How can I run that webapplication ?
 
Saloon Keeper
Posts: 28486
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First you need a copy of the Tomcat webapp server installed, which you can download as a ZIP file from tomcat.apache.org. Please note that depending on whether your JEE packages are using the old version packages such as javax.http.Servlet or the newer Jakarta EE packages, you'll need either Tomcat version 9 or lower (old packages) or Tomcat 10 or greater (jakarta.ee).

To install Tomcat, simply unzip it. To deploy your WAR, just copy it into the tomcat webapps directory.

Now start Tomcat: run the Tomcat bin\startup.bat command.

The correct URL for a WAR named AntTestProp would be 127.0.0.1:8080/AntTestProj/AddTwoNumbers.html - 124 is a mis-typed value. Instead of 127.0.0.1, you can also say localhost.
 
Marnix Gheyssen
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don’t know what versions of JEE packages I am using, so I’m going for the latest version of Tomcat.

Indeed, I mistyped the url.

I put the file AntTestProj.war in C:\Dev\Apache Tomcat\apache-tomcat-10.0.23\webapps.
If I start up Tomcat and paste the url in the browser, I get the addition tool. However, if I try to add two values, I get

"HTTP Status 404 – Not Found

Type Status Report
Message The requested resource [/AntTestProj/AddTwoNumbers] is not available
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Apache Tomcat/10.0.23"

So, I installed version 8.5.82 and followed the same steps. I ask the tool to add 3 and 5 and amazingly it returns 8.

So, apparently it does indeed work.
Thanks for your help.
 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic