Questions to upload application to Tomcat

Asked

Viewed 949 times

1

I am trying to upload a web application I made, through Tomcat. I generated the file WAR of my project where it contains the Back-end part, and managed the angular files (Front-end).

I have already installed Tomcat on my machine, and it is working normally when I open the default page (localhost:8080).

I put the Front file inside the Tomcat folder, and the Back file inside the folder WebApps, however when accessing the browser, error 404 occurs. I believe I am doing something wrong.

My question is this: where is the right place to put the project files I generated? And after I put it in the right folders, what I need to do?

  • If the answer worked, accept it as the answer to your question. Otherwise say what you hear wrong...

1 answer

1


After your application is finished and generated the file . War you should follow these steps:

In my case I installed toncat in the directory:

C: apache-Tomcat-9

You should put the file . War inside the webapps directory:

C: apache-Tomcat-9 webapps

Then go to the bin directory:

C: apache-Tomcat-9 bin

Click on any of these files to start the Tomcat server and automatically start your application:

startup bat.

or

startup sh.

Now just open the browser on port 8080 followed by the name of your file . War:

http://localhost:8080/

Let’s assume that your application is called Meuapp that generated the Meuapp.War file

To access it in the browser will look like this:

http://localhost:8080/Meuapp

One option would be:

For frontend application you will have to use a server that supports angular (NODE) and will have to use another port for that angular server. Because localhost:8080 will be being used by Tomcat.

You will have to have two servers one is the client(angular) the other is the backend server(Tomcat). (This is my way of seeing a possible solution, maybe it is possible to put the front and backend all on the same Tomcat)

So first initialize Tomcat and then angular on another server.

You just have to set the angular calls to the right Tomcat address.

PS: If you know English at a glance here for a tutorial that teaches how to deploy an angular application on Tomcat! Contradicting what I had said about putting on separate servers.

  • When accessing it in the browser, it gives the following error: Failed to load Resource: the server responded with a status of 404 () Remembering that I have two separate projects, one from Backend and the other from Frontend. The Backend I generated a War file. The Front I generated through the angular "ng build".

  • Yes, I use Maven

  • Well I only taught how to imnplant on Tomcat... which server Voce usually uses for its angular applications?

  • So actually this was the first web application I made, and in order to use it, I just run the project and open my browser. I make REST calls to the back end (where I use Spring Boot). So far without much complication. My intention was to be able to upload the application in Tomcat, so you don’t have to run the projects every time.

  • I get it, I’ll take a closer look at how to proceed with this situation. Well that I thought it was strange just to put it in Tomcat’s folder and it works... it would be too easy if it did. I appreciate the help...

  • @From a look calmly on the links I gave you.. it seems easy the precedimento. If the answer helped from a vote on it there or accepted with the answer :)! Ate more. If You Can Put your project on github.

  • Whoa, I got it! Github link: FRONT: https://github.com/GustavoZaffani/projectClientBACK: https://github.com/GustavoZaffani/commerce Vlw, see more

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.