Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling JMX in a spring application

Tags:

java

spring

jmx

I'm trying to disable jmx so that i don't get:

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'mbeanExporter'anymore. 

I've found a partial answer saying that I should include this in the application.properties file:

  • spring.datasource.jmx-enabled=false

So I created the file with that one line. But how do I make sure that Spring acutally reads it? Do I need to edit something in spring.xml? If so, where?

like image 892
OntZ Avatar asked Feb 19 '15 13:02

OntZ


People also ask

Is JMX enabled by default?

First, the java web application can be accessed via a web browser (typically on port 8080) but the detailed performance info is accessed on a different port called remote JMX. Java applications do not have this remote JMX port enabled by default. You have to manually enable it.

What is Spring JMX?

JMX with Spring. Java Management Extensions (JMX) is a technology that enables the instrumentation of Java. applications for management, monitoring, and configuration; it's available at http://java.sun.com/ javase/technologies/core/mntr-mgmt/javamanagement/.


2 Answers

You need to disable the setting in your application.properties file (it is automatically turned on if not set). Either edit or create this file: src/main/resources/config/application.properties

That is for a maven project, so if not in maven, just put 'resources' at the same level as your java folder.

You will just need this single line in the file (it can be blank otherwise):

spring.jmx.enabled=false

If you want to add other settings, here are all the options: http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

like image 117
MattC Avatar answered Sep 28 '22 04:09

MattC


In my case, it was IntelliJ.

IntelliJ have a setting "Enable JMX agent" in the run configuration. This should be unchecked to disable JMX.

If checked, this will override any setting that you make in the application via properties/yml.

like image 26
Johnu Avatar answered Sep 28 '22 03:09

Johnu