Spring Batch Admin(2.0.0.M1):创建bean batchMBeanExporter时出错 [英] Spring Batch Admin (2.0.0.M1): error creating bean batchMBeanExporter
问题描述
我正在尝试从Spring Boot应用程序运行spring batch admin.
I am trying to run spring batch admin from spring boot application.
我正在使用Michael(@mminella)的这个很好的例子.此应用程序可以正常工作.
I am using this excellent example from Michael (@mminella). This application works fine.
但是,我需要使用maven进行类似的应用程序;我继续并用相同的文件,作业,配置和依赖项创建了一个.但是我最终出现了以下异常情况.
However, I need similar application using maven; I went ahead and created one with same files, jobs, configs and dependencies. But I ended up in following exception.
我看到的唯一区别是spring-batch-core的版本.使用maven的版本是3.0.6,而使用gradle(迈克尔的应用程序)的版本是3.0.4.
Only difference I see is the version of spring-batch-core. With maven it's version is 3.0.6 while with gradle (Michael's application) has 3.0.4.
不确定使用maven时发生了什么;非常感谢您的帮助.请让我知道是否需要其他详细信息.
Not sure what's going on when I use maven; really appreciate your help. Please let me know if any additional details required.
期待您的投入.
谢谢
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchMBeanExporter' defined in URL [jar:file:/C:/Users/Admin/.m2/repository/org/springframework/batch/spring-batch-admin-manager/2.0.0.BUILD-SNAPSHOT/spring-batch-admin-manager-2.0.0.BUILD-SNAPSHOT.jar!/META-INF/spring/batch/bootstrap/manager/jmx-context.xml]: Cannot create inner bean 'org.springframework.aop.framework.ProxyFactoryBean#7807ac2c' of type [org.springframework.aop.framework.ProxyFactoryBean] while setting bean property 'jobService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.framework.ProxyFactoryBean#7807ac2c': Post-processing of FactoryBean's object failed; nested exception is java.lang.IllegalStateException: @Scheduled method 'removeInactiveExecutions' found on bean target class 'SimpleJobService' but not found in any interface(s) for a dynamic proxy. Either pull the method up to a declared interface or switch to subclass (CGLIB) proxies by setting proxy-target-class/proxyTargetClass to 'true'.
pom.xml
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<spring-batch-admin.version>2.0.0.BUILD-SNAPSHOT</spring-batch-admin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-admin-manager</artifactId>
<version>${spring-batch-admin.version}</version>
<exclusions>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-admin-domain</artifactId>
<version>${spring-batch-admin.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>sqljdbc4</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots-local</id>
<name>Spring Maven Snapshot Repository</name>
<url>https://repo.spring.io/libs-snapshot-local/</url>
</repository>
</repositories>
</project>
Spring Boot配置
Spring Boot config
@SpringBootApplication(exclude = {HypermediaAutoConfiguration.class, MultipartAutoConfiguration.class})
@EnableBatchAdmin
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
推荐答案
为了避免, JobController 空指针异常,放在
In order to avoid, JobController null pointer exception, put below
server.servletPath =/*
server.servletPath=/*
最诚挚的问候, 吉加尔.
Best regards, Jigar.
这篇关于Spring Batch Admin(2.0.0.M1):创建bean batchMBeanExporter时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!