• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Tomcat autodeploy doesnt seem to work for second host

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


I have defined another host in my server.xml:



Then I have uploaded my .WAR file into the folder "lab" that is in the same folder as default "webapps". But even after restarting tomcat several times the WAR is never unpacked nor deployed.


Could anyone hint my what I am doing wrong ? Thanks.
 
Saloon Keeper
Posts: 23282
158
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, Lukas!

If you expect to put webapps from the primary host in TOMCAT_HOME/webapps, but put webapps from a virtual host in TOMCAT_HOME/webapps/lab, then it doesn't work that way. The "webapps" directory has no magic powers. It's just a directory that the primary Tomcat host has been told to use. To deploy apps from the alternate virtual host, make a TOMCAT_HOME/lab diirectory and copy WARs into it the same way you'd copy WARs into TOMCAT_HOME/webapps.
 
Lukas Dakado
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:Welcome to the Ranch, Lukas!

If you expect to put webapps from the primary host in TOMCAT_HOME/webapps, but put webapps from a virtual host in TOMCAT_HOME/webapps/lab, then it doesn't work that way. The "webapps" directory has no magic powers. It's just a directory that the primary Tomcat host has been told to use. To deploy apps from the alternate virtual host, make a TOMCAT_HOME/lab diirectory and copy WARs into it the same way you'd copy WARs into TOMCAT_HOME/webapps.



I am sorry I probably described it badly.

My folder structure is as you described it:

TOMCAT_HOME/webapps <- in this folder there is no problem with deploymend
TOMCAT_HOME/lab <- .WAR inside this folder is never deployed
 
Tim Holloway
Saloon Keeper
Posts: 23282
158
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post a copy of the catalina.out log here? Also check the my.domain.log file.
 
Lukas Dakado
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:Can you post a copy of the catalina.out log here? Also check the my.domain.log file.



Domain log is not even created, this is catalina.out:


 
Tim Holloway
Saloon Keeper
Posts: 23282
158
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like :mydomain" is actually "admin.gameteam.cz". It seems to have tried to deploy, but the webapp's web.xml version was 4.0 and you're running Tomcat 8. You need Tomcat 9 to run web 4.0.
 
Lukas Dakado
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:Looks like :mydomain" is actually "admin.gameteam.cz". It seems to have tried to deploy, but the webapp's web.xml version was 4.0 and you're running Tomcat 8. You need Tomcat 9 to run web 4.0.



These domains work fine, I am trying to add a different one same way but its not even in the log.

here is my entire server.yml config, the domain that does not load at all is lab-vole.cz:

 
Tim Holloway
Saloon Keeper
Posts: 23282
158
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I should stop right here and say that I have not found Tomcat's virtual host capabilities to be that useful.

The reason for that is that usually I feed Tomcat via reverse proxies such as Apache and Nginx rather than have clients talk directly to Tomcat.

And the reasons I prefer.fronting with reverse proxies are:

  • Security - Tomcat cannot listen on the standard HTTP ports (80 and 443) without running under a prviliged account. That's a major security exposure.
  • Convenience - I find it a lot less trouble to set up SSL for a proxy server instead of making Tomcat handle it.
  • Flexibility - I can host both JEE and non-JEE (PHP, Python, etc. in the same domain.

  • And these days, a lot of people would add another reason. It's common to use Spring Boot and containers to run apps. In such cases, each app instance has its own private copy of Tomcat, but a reverse proxy serrver can make them look like a unified whole.

    The one thing that stands out to me is that you have a Context sub-element in your failing virtual host and its location is ".". I really don't think that will fly. It's claiming that the webapps directory itself is the webapp. In any event, it's considered bad practice (discouraged) to include Context elements in server.xml anyway. You can define Contexts as files under TOMCAT_HOME/conf/Catalina/{hostname}. Or you can include a META-INF/context.xml in your WAR. Or, if your needs are simple, omit the context altogether and Tomcat will synthesize on based on the WAR file or exploded WAR in the webapps directory for the Host.

     
    It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
    the value of filler advertising in 2020
    https://coderanch.com/t/730886/filler-advertising
    reply
      Bookmark Topic Watch Topic
    • New Topic