Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javax.management.InstanceNotFoundException: org.springframework.boot:type=Admin,name=SpringApplication

Tags:

I developed a Spring boot application and the functionality of the application is working fine. However, at the time of startup, I see the below exception multiple times.

When I ran the same application a couple of weeks back I did not see any such exception. The code base has not changed after that. I am wondering if it has to do something with the environment.

The reason for my post is I would like to understand more about the cause of the exception and how to fix it. I could not find much help when I googled. This here did not work.

The Spring batch process extracts data from Oracle DB and writes it into a JSON file after some processing. I have posted the pom.xml.

javax.management.InstanceNotFoundException: org.springframework.boot:type=Admin,name=SpringApplication     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095) ~[na:1.8.0_161]     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getClassLoaderFor(DefaultMBeanServerInterceptor.java:1444) ~[na:1.8.0_161]     at com.sun.jmx.mbeanserver.JmxMBeanServer.getClassLoaderFor(JmxMBeanServer.java:1324) ~[na:1.8.0_161]     at javax.management.remote.rmi.RMIConnectionImpl$6.run(RMIConnectionImpl.java:1365) ~[na:1.8.0_161]     at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_161]     at javax.management.remote.rmi.RMIConnectionImpl.getClassLoaderFor(RMIConnectionImpl.java:1362) ~[na:1.8.0_161]     at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:813) ~[na:1.8.0_161]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161]     at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:361) ~[na:1.8.0_161]     at sun.rmi.transport.Transport$1.run(Transport.java:200) [na:1.8.0_161]     at sun.rmi.transport.Transport$1.run(Transport.java:197) [na:1.8.0_161]     at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_161]     at sun.rmi.transport.Transport.serviceCall(Transport.java:196) [na:1.8.0_161]     at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) [na:1.8.0_161]     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) [na:1.8.0_161]     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683) [na:1.8.0_161]     at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_161]     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) [na:1.8.0_161]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_161]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_161]     at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_161] 

POM.xml

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

<groupId>com.mySample</groupId> <artifactId>db-extraction</artifactId> <version>1.0.0</version>  <parent>     <groupId>org.springframework.boot</groupId>     <artifactId>spring-boot-starter-parent</artifactId>     <version>1.5.10.RELEASE</version> </parent>  <properties>     <java.version>1.8</java.version> </properties>  <dependencies>     <dependency>         <groupId>org.springframework.boot</groupId>         <artifactId>spring-boot-starter-batch</artifactId>     </dependency>     <dependency>         <groupId>com.oracle</groupId>         <artifactId>ojdbc7</artifactId>         <version>12.1.0.1</version>     </dependency>       <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->     <dependency>         <groupId>org.apache.commons</groupId>         <artifactId>commons-lang3</artifactId>         <version>3.0</version>     </dependency>      <!-- https://mvnrepository.com/artifact/commons-dbutils/commons-dbutils -->     <dependency>         <groupId>commons-dbutils</groupId>         <artifactId>commons-dbutils</artifactId>         <version>1.6</version>     </dependency>      <!-- https://mvnrepository.com/artifact/commons-dbutils/commons-dbutils -->     <dependency>         <groupId>org.apache.commons</groupId>         <artifactId>commons-collections4</artifactId>         <version>4.1</version>     </dependency>      <dependency>         <groupId>com.fasterxml.jackson.core</groupId>         <artifactId>jackson-databind</artifactId>     </dependency>      <dependency>         <groupId>com.h2database</groupId>         <artifactId>h2</artifactId>     </dependency> </dependencies>   <build>     <plugins>         <plugin>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-maven-plugin</artifactId>         </plugin>         <plugin>             <groupId>org.apache.maven.plugins</groupId>             <artifactId>maven-eclipse-plugin</artifactId>             <configuration>                 <downloadSources>true</downloadSources>                 <downloadJavadocs>true</downloadJavadocs>             </configuration>         </plugin>     </plugins> </build> 

like image 705
Andy Avatar asked May 20 '18 14:05

Andy


2 Answers

I had the same issue with IDEA IntelliJ. The problem was IntelliJ's default server configurations. You just need to remove the 'Enable launch optimization' and 'Enable JMX agent' checkboxes, then it works!

Steps:

  • Edit Configurations
  • choose your project
  • remove the 'Enable launch optimization' and 'Enable JMX agent' checkboxes
like image 101
Zoe Avatar answered Sep 20 '22 16:09

Zoe


Are you launching this from Eclipse? If so, I found a way to overcome this issue from my Eclipse oxygen: Go to the launch configuration either from the STS plugin Spring Boot dashboard or from Run Configurations from the Run menu. Then untick Enable JMX checkbox and run it. Hope it helps

like image 25
Pedro Bravo Avatar answered Sep 16 '22 16:09

Pedro Bravo