我最近升级了hibernate-reactive到最新版本,并努力修复NoClassDedfFound的问题,我试图遵循github文档中的示例,这里是我用于rds持久化的依赖项列表
// rds reactive db
implementation 'org.hibernate.reactive:hibernate-reactive-core:2.0.0.Final'
implementation "org.hibernate:hibernate-core:6.2.4.Final"
implementation 'com.ongres.scram:client:2.1'
implementation 'org.hibernate.validator:hibernate-validator:7.0.2.Final'
implementation 'io.smallrye.reactive:mutiny-reactor:2.2.0'
implementation 'io.vertx:vertx-pg-client:4.4.2'
implementation 'org.postgresql:postgresql'
implementation 'org.glassfish:jakarta.el:4.0.2'
在尝试创建EntityManagerFactory时发生异常
@Bean
public EntityManagerFactory entityManagerFactory(@Autowired(required = false) SpringLiquibase liquibase) {
return createEntityManagerFactory("postgres", hibernateProperties());
}
public Map<String, String> hibernateProperties() {
var connectionUrl = rdsProperties.getConnectionUrl();
System.out.println(connectionUrl);
var isNotProd = !activeProfile.equals("prod");
return Map.of(
"jakarta.persistence.jdbc.url", connectionUrl,
"jakarta.persistence.jdbc.user", rdsProperties.getUsername(),
"jakarta.persistence.jdbc.password", rdsProperties.getPassword(),
"jakarta.persistence.schema-generation.database.action", rdsProperties.getDdlAuto(),
"hibernate.show_sql", "false", //String.valueOf(isNotProd),
"hibernate.default_schema", rdsProperties.getSchema()
);
}
1条答案
按热度按时间2ledvvac1#
您需要检查您在项目中使用的是正确的Hibernate ORM版本。
ComparableExecutable是Hibernate ORM 6.2.4.Final中的一个新接口。
我可以看到您的配置中有一个错误,Hibernate ORM的正确GAV应该是:
查看该组:org.hibernate.orm
但是如果你包含
org.hibernate.reactive:hibernate-reactive-core:2.0.0.Final
,就没有必要包含Hibernate ORM。It's already a transitive dependency。