0

Two spring boot applications are running on same tomcat, my configuration are as follows:

application.properties

For first application
spring.application.name=app1
spring.jmx.default-domain=app1

For second application
spring.application.name=app2
spring.jmx.default-domain=app2

About two application
app1 : Web application + REST API
app2 : Service (running in infinite loop) with @PostConstruct

First I think it was problem of @PostConstruct so I have tried following links:
Other options for @postconstruct
Implementing interface as component

Then I came to read this question:
Multiple spring-boot under same tomcat

So I made changes to application.properties still my issue not resolved.

Problem:
When I deploy app1 then app2 it works totally fine (very first time), but restarting tomcat will start both application (log files containing data) normally but it fails to load webpage of app1 it gives 503 service unavailable

Answer appericiated.

  • Any error traces in server.log file? – Dark Knight Dec 26 '18 at 05:41
  • @DarkKnight No error in apache, tomcat and application log files, that's why not able to figure out problem –  Dec 26 '18 at 05:45
  • @iamrajshah - first of all, it's first time I am knowing about multiple spring boot apps in same servlet container. As far as I understood, when you restart it creates the html pages / resource files but overwrites with other app's data. Please try to change path of resource files in both apps (with different name and path) and try again. – smilyface Dec 26 '18 at 07:22
  • @iamrajshah - also make sure the `jmx` port to connect tomcat is different in both apps (I guess it should be different for each apps). – smilyface Dec 26 '18 at 07:27
  • @smilyface can you specify me the `jmx port` property? I haven't find anything like that –  Dec 26 '18 at 10:09
  • @iamrajshah - I mean to say AJP port. Sorry for the confusion. it is the port which connects the servlet container with the server. Here in your case it's tomcat. As I mentioned above, I am new to multiple boot apps in same container. jmx port will be there internally. We dont handle it manually. But in your case, I guess we may need to handle it manually. I have done multiple-tomcat-instances long before (which is only for traditional tomcat) where I manually mentioned start-up , shutdown and AJP ports independantly. – smilyface Dec 26 '18 at 10:22

0 Answers0