2

I updated from Spring Boot 2.2.6.RELEASE to 2.3.1.RELEASE and suddenly, all my @ManagedResources beans are missing in the JMX console and even all from Spring Boot itself. However, all jolokia, java.lang, java.nio, org.apache.activemq and org.apache.logging.log4j2 are there.

Interestingly, this only happens when the application is installed on the server. When I run it from IntelliJ, all managed beans are there.

So I'm suspecting some issue in the order in which the beans are loaded but I really have no idea where to start looking. Has anyone experienced something like this?

This is my Application class:

@SpringBootApplication(
  scanBasePackageClasses = {
    // Some shared @Component in a common module
    com.example.convert.Import.class,
    com.example.config.Import.class,
    DispatcherApplication.class
  },
  // Since there are two datasources, they need to be configured manually
  exclude = {DataSourceAutoConfiguration.class, JdbcRepositoriesAutoConfiguration.class}
)
@EnableScheduling
@EnableIntegrationGraphController
@EnableIntegrationManagement
@EnableMapRepositories(includeFilters = {@ComponentScan.Filter(type = FilterType.REGEX, pattern = ".+\\.map\\..+")})
@EnableIntegration
@EnableJms
@EnableRetry
@EnableConfigurationProperties(DispatcherProperties.class)
public class DispatcherApplication {

  public static void main(String[] args) {
    SpringApplication.run(DispatcherApplication.class, args);
  }
}

Somewhere (can't find it right now) someone had a problem that the component-scan was done after/before some JMX configuration but so far, I've not customized any JMX behavior.

Michel Jung
  • 2,966
  • 6
  • 31
  • 51
  • When you say "installed on server" does it mean that you're running the WAR with a spring boot app? Can it be a class of different spring/spring-boot versions? – Mark Bramnik Jul 27 '20 at 19:23
  • I'm using gradle and `org.springframework.boot:spring-boot-gradle-plugin:2.3.1.RELEASE` which manages all my dependency versions and the Gradle `application` plugin for packaging. All the jars on the server look good, no conflict or duplicates. – Michel Jung Jul 27 '20 at 19:31

1 Answers1

3

It turned out that I actually updated from 2.1.2.RELEASE to 2.2.6.RELEASE and then to 2.3.1.RELEASE on the same day and JMX is disabled since 2.2.0.M1 (see also: Spring Boot 2.2 Release Notes.

Therefore, spring.jmx.enabled=true is now required, which was set by IntelliJ's run configuration.

Michel Jung
  • 2,966
  • 6
  • 31
  • 51
  • it's worth noting, that this must be set via `@SpringBootTest.properties` or the like annotations. At least i have the impression that this property cannot be set in a the `application.yaml` files up to SB 2.7.1. – elonderin Sep 21 '22 at 11:55