'tomcat 9 (win2019server) runs perfectly from cmd, but I get 404 from windows service

I start by saying that I am linux user, so I have a very basic understanding on windows server architecture :) I have a installed tomcat 9 manually on a windows server 2019 by copying the tomcat folder in C:\tomcat\tomcat9. I created the requested environmental variables (JAVA_HOME, CATALINA_HOME) and then I ran catalina.sh run from a terminal cmd. After a couple of minutes the process is complete and I have a full working web application.

The unexpected behaviour starts here.

I install the tomcat windows service by running the service.bat install.

I kill the terminal.

I go to services.msc

I start the service.

I wait for a couple of minutes to be sure that everything is loaded.

I load perfectly the tomcat homepage and I can load the tomcat app manager page without any problems

BUT I get 404 when trying to load my web application.

I have tried so many different configurations like changing the "Log on as:" in tomcat service properties, changing permissions to folders but still 404 is what I get. My windows server account role is Administrator. I suspect that this has something to do with permissions/ownership, but I haven't figured it out yet.

NOTE: even when I run tomcat from simple cmd without "run as administrator" I still have my web app working except some messages in the terminal that I cannot access the log files.

NOTE2:I don't want to install tomcat as an application because in the tomcat folder I have copied I have applied a ton of configurations that I wish I didn't repeat them again :)

Any help/suggestion?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source