Skip to content

[Spring Boot integration] Changing the jolokia default path to avoid 404 error #14475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

insukcho
Copy link

@insukcho insukcho commented Jul 9, 2025

Proposed commit message

The Jolokia in Spring Boot is enabled by Spring-boot-actuator as described in the reference, and the endpoint should have /actuator in front of the current default path. If we keep this default path, it will return 404 and the Elastic Agent's status will be changed to unhealthy with the error logs below:

{
    "log.level": "error",
    "@timestamp": "2025-04-23T20:19:38.012Z",
    "message": "Error fetching data for metricset jolokia.jmx: HTTP error 404 in : 404 ",
    "component": {
        "binary": "metricbeat",
        "dataset": "elastic_agent.metricbeat",
        "id": "jolokia/metrics-default",
        "type": "jolokia/metrics"
    },
    "log": {
        "source": "jolokia/metrics-default"
    },
    "ecs.version": "1.6.0",
    "log.origin": {
        "file.line": 333,
        "file.name": "module/wrapper.go",
        "function": "github.com/elastic/beats/v7/metricbeat/mb/module.(*metricSetWrapper).handleFetchError"
    },
    "service.name": "metricbeat"
}

To avoid the confusion, suggest to change the default path value with the valid one.

Additionally, the current hosts description is making confusion:

"Host for Spring Boot metrics. (example: http://localhost:8090/actuator/jolokia)."

Suggest to fix the example with only host URL, and move the left to the path's description.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

How to test this PR locally

Reproduced and tested it with the version below:

  • openjdk 17.0.14, 21.0.6
  • Spring Boot 2.7.17
  • Elastic Spring Boot Integration 1.8.1
  • jolokia-core 1.7.2
full pom.xml config
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.example</groupId>
	<artifactId>myproject</artifactId>
	<version>0.0.1-SNAPSHOT</version>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.7.17</version>
	</parent>

	<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

	<!-- Additional lines to be added here... -->
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

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

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-thymeleaf</artifactId>
		</dependency>
		
		<dependency>
			<groupId>org.springframework.security</groupId>
			<artifactId>spring-security-test</artifactId>
			<scope>test</scope>
		</dependency>

		<!-- Elastic Spring Boot Integration requirements-->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>

		<dependency>
			<groupId>org.jolokia</groupId>
			<artifactId>jolokia-core</artifactId>
		</dependency>

	</dependencies>

</project>

Screenshots

Current default value in UI
image

Suggested value in UI
image

Jolokia in Spring Boot is enabled by Spring-boot-actuator as described in the [reference](https://www.elastic.co/docs/reference/integrations/spring_boot#requirements), and the endpoint should have `/actuator` in front of the current default path. If we keep this default path, it will return 404 and the Elastic Agent's status will be changed to unhealthy. To avoid the confusion, suggest to change the default path value with the valid one
@insukcho insukcho requested a review from a team as a code owner July 9, 2025 19:53
@insukcho insukcho added enhancement New feature or request Integration:spring_boot Spring Boot labels Jul 9, 2025
@andrewkroh andrewkroh added the Team:Obs-InfraObs Observability Infrastructure Monitoring team [elastic/obs-infraobs-integrations] label Jul 9, 2025
@elastic-vault-github-plugin-prod

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

Improve the path and host descriptions to avoid the confusion
Copy link

@elasticmachine
Copy link

💚 Build Succeeded

History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Integration:spring_boot Spring Boot Team:Obs-InfraObs Observability Infrastructure Monitoring team [elastic/obs-infraobs-integrations]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants