我正在研究Spring Boot Axon
示例。下列的https://www.youtube.com/watch?v=lBKZOTe9QM4
如果我使用了axon core
和axon amqp
版本到3.0-RC1
,那么它工作正常。但是我使用3.4版本,然后我在启动时得到以下错误。有什么快速的帮助吗?
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call the method org.axonframework.eventsourcing.eventstore.jpa.JpaEventStorageEngine.<init>(Lorg/axonframework/common/jpa/EntityManagerProvider;)V but it does not exist. Its class, org.axonframework.eventsourcing.eventstore.jpa.JpaEventStorageEngine, is available from the following locations:
jar:file:/C:/Users/user/.m2/repository/org/axonframework/axon-core/3.4/axon-core-3.4.jar!/org/axonframework/eventsourcing/eventstore/jpa/JpaEventStorageEngine.class
It was loaded from the following location:
file:/C:/Users/user/.m2/repository/org/axonframework/axon-core/3.4/axon-core-3.4.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.axonframework.eventsourcing.eventstore.jpa.JpaEventStorageEngine
波姆。xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.6.RELEASE</version>
<!-- <version>1.4.2.RELEASE</version> -->
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-spring-boot-starter</artifactId>
<version>3.0-RC1</version>
</dependency>
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-amqp</artifactId>
<!-- <version>3.0-RC1</version> -->
<version>3.4</version>
</dependency>
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-core</artifactId>
<!-- <version>3.0-RC1</version> -->
<version>3.4</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency> -->
</dependencies>
去民主化。JAVA
@SpringBootApplication
public class DemoComplaintsApplication {
public static void main(String[] args) {
SpringApplication.run(DemoComplaintsApplication.class, args);
}
@RestController
public static class ComplaintAPI {
private final ComplaintQueryObjectRepository repostory;
private final CommandGateway commandGateway;
public ComplaintAPI(ComplaintQueryObjectRepository repostory, CommandGateway commandGateway) {
this.repostory = repostory;
this.commandGateway = commandGateway;
}
@PostMapping
public CompletableFuture<String> fileCompplaint(@RequestBody Map<String, String> request) {
String id = UUID.randomUUID().toString();
return commandGateway
.send(new FileComplaintCommand(id, request.get("company"), request.get("description")));
}
@GetMapping
public List<ComplaintQueryObject> findAll() {
return repostory.findAll();
}
@GetMapping("/{id}")
public ComplaintQueryObject find(@PathVariable String id) {
//return repostory.findOne(id);
return repostory.findById(id).get();
}
}
@Aggregate
public static class Complaint {
@AggregateIdentifier
private String complaintId;
public Complaint() {
}
@CommandHandler
public Complaint(FileComplaintCommand command) {
apply(new ComplaintFileEvent(command.getId(), command.getCompany(), command.getDescription()));
}
@EventSourcingHandler
public void on(ComplaintFileEvent event) {
this.complaintId = event.getId();
}
}
@Component
public static class ComplaintQueryObjectUpdater {
private final ComplaintQueryObjectRepository repository;
public ComplaintQueryObjectUpdater(ComplaintQueryObjectRepository repository) {
this.repository = repository;
}
@EventHandler
public void on(ComplaintFileEvent event) {
repository.save(new ComplaintQueryObject(event.getId(), event.getCompany(), event.getDescription()));
}
}
public static class FileComplaintCommand {
@TargetAggregateIdentifier
private String id;
private String company;
private String description;
public FileComplaintCommand(String id, String company, String description) {
super();
this.id = id;
this.company = company;
this.description = description;
}
public String getId() {
return id;
}
public String getCompany() {
return company;
}
public String getDescription() {
return description;
}
}
}
问题是:
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-spring-boot-starter</artifactId>
<version>3.0-RC1</version>
</dependency>
应该是:
<dependency>
<groupId>org.axonframework</groupId>
<artifactId>axon-spring-boot-starter</artifactId>
<version>3.4</version>
</dependency>
自从您将axon库升级到v3之后。4.
我有个问题。尝试改变版本(就像它在互联网上说的),但没有帮助。我已经读过了,这些答案修正了应用程序的类路径,使它包含一个单一的、兼容的org.springframework.plugin.core.pluginregistry版本,但它也没有帮助。 问题: 更正应用程序的类路径,使其包含Org.SpringFramework.http.Converter.Support.AllEncompassi
我正在尝试通过hibernate和Spring-Boot连接MongoDB数据库。当我试图连接到MongoDB时,我得到了以下错误。请帮我通过Hibernate连接。在我的build.gradle中,我只有“hibernate-ogm-mongoDB”依赖项。
我在运行我的Spring boot应用程序时遇到以下错误,我是Spring boot和弹性搜索的新手,请帮助解决这个问题。并在下面附上了我的pom依赖项。提前感谢, ****************************应用程序启动失败***************************************************
在一个RCE漏洞之后,我最近通过sprint boot升级到了2.6.6。然而,现在我的应用程序并没有开始与错误: 应用程序无法启动 描述: __________: 试图调用不存在的方法。尝试从以下位置进行:org.springframework.boot.SpringApplication.run(SpringApplication.java:301) 以下方法不存在:org.springfra
我正在使用spring cloud将一个模块化应用程序迁移到一个microsevrices应用程序中,当我将一个模块迁移到microservice并运行它时,出现了一个问题: 更正应用程序的类路径,使其包含org.springframework.plugin.core.pluginregistry的一个兼容版本 这是一个错误: 这是我的pom.xml: 这是我的swaggreconfig.java