我开发了一个Spring Boot应用程序,该应用程序的功能运行良好。但是,在启动时,我多次看到以下异常。
几周前,当我运行相同的应用程序时,我没有看到任何此类异常。此后,代码库未更改。我想知道它是否与环境有关。
我发布帖子的原因是,我想了解更多有关异常原因及其解决方法的信息。我在Google上找不到太多帮助。
Spring批处理过程从Oracle DB中提取数据,经过一些处理后将其写入JSON文件。我已经发布了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>
您要从Eclipse启动它吗?如果是这样,我找到了一种克服我的Eclipse氧气的方法:从STS插件Spring Boot仪表板或从“运行”菜单的“运行配置”进入启动配置。然后取消选中“启用JMX”复选框并运行它。希望能帮助到你