0

I'm trying to deploy a war file in the webapps folder of tomcat 9. But I want my application to be loaded at the startup, not the tomcat default page. So I configured docBase in the Context tag in server.xml to point to my application like this:

<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="MyApp/UI/"></Context> ... </Host>

But on the startup of tomcat server, it is giving an error message that MyApp/UI/ is not found, as the unpack of war file wouldn't have happened. So I'm commenting the Context tag and starting the server, then it is working well. Once it starts working I'm adding the Context tag so that on startup MyApp/UI/ will be loaded.

How to solve this issue? Like, is there any conditional Context tag that can be given in server.xml, so that it considers Context tag up on certain condition.

Please help me solving this issue. Thanks in advance.

  • https://stackoverflow.com/questions/5328518/deploying-my-application-at-the-root-in-tomcat – svarog Aug 04 '17 at 11:29
  • The problem is, at the startup of server it is giving the error like "The main resource set specified [$CATALINA_HOME\webapps\MyApp\UI] is not valid". If I manually extract the war file, then the server is starting properly. What can be done to avoid the manual extraction of war file into folder?? – Uttam Singapura Aug 14 '17 at 06:41
  • was something printed onto `catalina.out` ? – svarog Aug 14 '17 at 09:18
  • you mean to ask in the log of catalina.bat run? – Uttam Singapura Aug 14 '17 at 10:44
  • if you're in linux there should be a `./tomcat/logs/catalina.out` file that logs everything in tomcat, if in windows there should be several logs by date, like `catalina.2017-08-10.log`. – svarog Aug 14 '17 at 12:27
  • Yes. Here is the error message:- Caused by: "java.lang.IllegalArgumentException: The main resource set specified [..\tomcat\webapps\MyApp\UI] is not valid." MyApp.war is not being extracted to MyApp folder, since it is looking for the UI folder inside MyApp folder, which is specified in the Context path. – Uttam Singapura Aug 16 '17 at 03:03

0 Answers0