jhipster/jhipster-registry

JHipster Registry can't be accessed on Tomcat 9

emeraldhieu opened this issue · 1 comments

Overview of the issue

JHipster can't be accessed when deployed on Tomcat 9

Motivation for or Use Case

I'd like to deploy JHipster Registry on Tomcat along with other services to reduce the amount of embeded container if using Spring Boot

Reproduce the error
  1. Checkout jhipster-registry
  2. Prepare "central-config" correctly in jhipster-registry
  3. mvn clean package -DskipTests -Pprod
  4. Copy the war file into Tomcat's webapps
  5. Add this config to server.xml with the hope that I can access JHipster Registry via "localhost:8761"
  <Service name="jhipster-registry">

    <Connector port="8761" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

     <Engine name="Catalina" defaultHost="localhost">
        <Host name="localhost"  appBase="jhipster-registry"
          unpackWARs="true" autoDeploy="true">
        </Host>
     </Engine>
  </Service>
  1. Start Tomcat
  2. Logs look good; no error
  3. Access http://localhost:8761 shows "HTTP 404 Not Found"
Related issues

Nothing

Suggest a Fix

I don't quite know.

JHipster Registry Version(s)

6.8.0

Browsers and Operating System

MacOS, Chrome

  • Checking this box is mandatory (this is just to show you read everything)

The JHipster-Registry is not adapt by default to work within Tomcat. It is a standalone Java application that can run as a desktop application or be configured as a system service.

Servlet containers like Tomcat expect the registry to meet some contracts to be deployed. You must initialize the Servlet context required by Tomcat by implementing the SpringBootServletInitializer interface.

You can see the follow implementation in generator : https://github.com/jhipster/generator-jhipster/blob/main/generators/server/templates/src/main/java/package/ApplicationWebXml.java.ejs