0

According to the Spring Boot 1.2.3 Reference Docs. Enabling jolokia seems to be as simple as adding as adding the following Maven dependency:

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

While this does work for a Spring Boot application packaged as a fat jar, I am unable to get this to work when packaged as a WAR file.

The root cause appears to be:

Caused by: java.lang.ClassNotFoundException: org.json.simple.JSONAware

I'm using STS for development purposes and deploying to an embedded pivotal tc Server 3.1. The dependency(json-simple-1.1.1.jar) containing the org.json.simple.JSONAware does appear under the Maven Dependency node so I'm not sure what the issue is.

2 Answers 2

1

So as I was composing the question I stumbled onto a solution that at least seems to work for me:

I took a look at the effective POM and found this dependency declaration:

      <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1.1</version>
        <optional>true</optional>
      </dependency>

So for lack of better option I declared the following dependency explicitly

<dependency>
    <groupId>com.googlecode.json-simple</groupId>
    <artifactId>json-simple</artifactId>
    <optional>false</optional>
  </dependency>

Adding false to the the <optional> element seemed necessary.

Now I can access jolokia via the following url:

http://<myurl>:<myport>/<appcontext>/jolokia
1

Looking at 1.4.4 this seems to have been fixed:

<dependency>
  <!-- Make json-simple non-optional. 
       It is marked optional in boot-dependencies, but required by jolokia-core.
       Without this fix it would be missing when used war-packaging. -->
  <groupId>com.googlecode.json-simple</groupId>
  <artifactId>json-simple</artifactId>
  <optional>false</optional>
</dependency>

Yet I'm seeing similar issues running a war in JBoss.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.