【发布时间】:2021-04-29 20:01:13
【问题描述】:
我刚刚完成了从 wildfly 9 到 23 的更新,现在我正在重新设计我的 arquillian 实现以使用新的应用服务器版本。
依赖管理:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.4.1.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>wildfly-jakartaee8-with-tools</artifactId>
<scope>import</scope>
<type>pom</type>
<version>21.0.2.Final</version>
</dependency>
</dependencies>
</dependencyManagement>
依赖关系:
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-embedded</artifactId>
<version>3.0.1.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>${arquillian.version}</version>
<scope>test</scope>
</dependency>
当我运行测试时,我得到了这个错误:
[ERROR] org.<company name>.crs.auth.CrsUserServiceTest Time elapsed: 71.828 s <<< ERROR!
org.jboss.arquillian.container.spi.client.container.DeploymentException:
Cannot deploy ert-tests.war: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"ert-tests.war#ertDatasource\"" => "javax.persistence.PersistenceException: [PersistenceUnit: ertDatasource] Unable to build Hibernate SessionFactory
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: ertDatasource] Unable to build Hibernate SessionFactory
Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.collection.OneToManyPersister
Caused by: org.hibernate.HibernateException: Unable to parse order-by fragment
Caused by: java.lang.ClassCastException: antlr.CommonToken cannot be cast to antlr.Token"}}}}
网上查了很多人说这是因为antlr的版本冲突(通常是手动导入的和hibernate自带的)。这是我的休眠导入:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.20.Final</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
</exclusion>
<exclusion>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
</exclusions>
</dependency>
明确不带 antlr。事实上,如果我运行 mvn dependency:tree 并搜索 antlr 我没有得到任何结果。所以,如果我在类路径中没有任何版本或根本没有导入,我不确定我的版本是如何冲突的。
我能够找到This 文章提到这可能是由于多个应用程序的运行。但不确定这是否适用,因为我只运行了一个应用程序并且只有一个实例(我认为)。在启动 arquillian 时,我从 Wildfly 15:50:35,940 INFO [io.jaegertracing.internal.JaegerTracer] (MSC service thread 1-4) No shutdown hook registered: Please call close() manually on application shutdown. 收到了这条消息,但是当我运行测试时,我收到了两次这条消息。想知道这是否会导致问题,如果不是,还有什么可能?
【问题讨论】:
标签: java hibernate wildfly jboss-arquillian