0

I have a spring-boot jar with the the following conf:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

      <dependency>
    <groupId>org.jolokia</groupId>
    <artifactId>jolokia-core</artifactId>
    <version>1.2.2</version>
  </dependency>
  <dependency>
    <groupId>org.jolokia</groupId>
    <artifactId>jolokia-client-javascript</artifactId>
    <version>1.2.2</version>
    <type>javascript</type>
  </dependency>

management properties

info.app.name=MyApp
info.app.description="blah blah"
info.app.version=1.0.0
peg.sendInterval.millis=3600000
instance.name=Appster
jolokia.config.debug=true
endpoints.jolokia.enabled=true
endpoints.jolokia.path=jolokia
spring.jmx.enabled=true
endpoints.jmx.enabled=true
management.port=9001
management.address=<super-secret-ip>
security.user.name=admin
security.user.password=cracked

When I specify management port (9001), I see a separate Tomcat instance for that. There is a default Tomcat instance that runs on 8080 / localhost in addition to :9001. If I specify the management port as 8080, nothing works. How can I disable the default one running on 8080?

user425518
  • 81
  • 1
  • 9
  • Is your goal to expose the management endpoints over HTTP in an app that otherwise doesn't use HTTP? Alternatively, it should be possible to have both ports configured to the same value. You said that "nothing works". Can you expand on that a bit? What failure do you see? How did you determine that things aren't working? – Andy Wilkinson Dec 20 '14 at 10:43
  • What does the application.properties looks like did specify what port you want spring boot embedded server to use? – ndrone Dec 20 '14 at 16:22

1 Answers1

1

Setting server.port=-1 will switch off the main application web endpoints (per the docs here).

Dave Syer
  • 56,583
  • 10
  • 155
  • 143
  • Thanks Dave. That disables the endpoint as you mentioned. But,the embedded Tomcat is still loaded. Is there a property to prevent loading the default embedded Tomcat. I can stop and destroy it using JMX but I am sure there must be some property to prevent loading. – user425518 Dec 23 '14 at 00:20
  • 1
    You can set `spring.main.webEnvironment=false` (or use the setter in`SpringApplication`). Is that what you mean? – Dave Syer Dec 23 '14 at 06:54
  • I am using Jolokia for JMX-HTTP bridge which spawns a separate embedded Tomcat in addition to the default. I only want to shut down the default, not the 2nd one. The option you've specified seems to prevent loading both. – user425518 Dec 24 '14 at 01:05
  • If you use the Spring Boot support for Jolokia I think it should work with `webEnvironment=false`in the main application context. Are you using some other Jolokia wrapper? – Dave Syer Dec 24 '14 at 08:11
  • I edited my OP, it now shows the Jolokia specific part of the maven pom.xml. It seems to be in sync with the spring-boot docs. – user425518 Dec 24 '14 at 18:12
  • It looks to me like you just want a single web server with Spring Boot actuator endpoints. If that's the case then it should just work out of the box. Why do you need the child context? (I.e. you just need to set `server.port` and not `management.port` to customize the container.) – Dave Syer Dec 26 '14 at 10:02
  • I am trying to set up Jolokia here and it does not show up without a different management.port value. – user425518 Dec 30 '14 at 18:09
  • Maybe because you set management.(something else)? Maybe the address setting in your OP. It works for me last time I looked and they use it in XD so I'm sure we would have heard if there was a problem. – Dave Syer Dec 30 '14 at 19:29