gpt4 book ai didi

java - 包含导致 SpringRunner contextLoad 错误的 com.intuit.karate 依赖项

转载 作者:行者123 更新时间:2023-11-30 10:03:49 26 4
gpt4 key购买 nike

Mac Mojave 10.14.4
当运行这个 maven 命令时

mvn clean install   

我正在使用 Spring Boot 2.1.5-Release 并且有一个简单的 contextLoad 测试失败,只要我将特定版本的 com.intuit.karate 0.9.2 作为 pom.xml 中的依赖项我包含该版本 (0.9.2),因此我可以围绕它开发测试,现有测试失败

   <dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-apache</artifactId>
<version>0.9.2</version>
<scope>test</scope>
</dependency>
<!-- karate test deps -->
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit5</artifactId>
<version>0.9.2</version>
<scope>test</scope>
</dependency>

我降级到版本 0.9.1,问题消失了。同样通过修改 pom.xml 来排除它也可以工作

    <dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-apache</artifactId>
<version>0.9.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- karate test deps -->
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit5</artifactId>
<version>0.9.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
</exclusion>
</exclusions>
</dependency>

它似乎被缩小到这种传递依赖包含,当被排除在外时它可以正常工作。我看不到任何会导致此问题在 SpringRunner 测试中失败的关系,除非它在 ​​libXXX.dylib 文件中存在

      <dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>12-ea+9</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
</exclusion>
</exclusions>
</dependency>
@RunWith(SpringRunner.class)
@SpringBootTest
public class JugToursApplicationTests {

@Test
public void contextLoads() {
}
}

日志:

    2019-05-17 13:14:50.311  INFO 2885 --- [           main] c.s.e.s.JugToursApplicationTests         : Starting JugToursApplicationTests on svuslp00099.local with PID 2885 (started by chesterpressler in /Users/chesterpressler/development/spring-react)
2019-05-17 13:14:50.314 INFO 2885 --- [ main] c.s.e.s.JugToursApplicationTests : No active profile set, falling back to default profiles: default
2019-05-17 13:14:51.766 INFO 2885 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-05-17 13:14:51.842 INFO 2885 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 65ms. Found 2 repository interfaces.
2019-05-17 13:14:52.403 INFO 2885 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$e99c3d5a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-17 13:14:52.757 INFO 2885 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-05-17 13:14:53.008 INFO 2885 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2019-05-17 13:14:53.098 INFO 2885 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-05-17 13:14:53.171 INFO 2885 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.3.10.Final}
2019-05-17 13:14:53.174 INFO 2885 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-05-17 13:14:53.428 INFO 2885 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2019-05-17 13:14:53.587 INFO 2885 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2019-05-17 13:14:53.964 WARN 2885 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.cfg.beanvalidation.IntegrationException: Error activating Bean Validation integration
2019-05-17 13:14:53.965 INFO 2885 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2019-05-17 13:14:53.970 INFO 2885 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2019-05-17 13:14:53.986 INFO 2885 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-17 13:14:54.000 ERROR 2885 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.cfg.beanvalidation.IntegrationException: Error activating Bean Validation integration
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105) ~[spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127) [spring-boot-test-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) [spring-test-5.1.7.RELEASE.jar:5.1.7.RELEASE]

最佳答案

好的,根据您的报告,很明显我们遇到了 JavaFX 和 Spring/Boot 的奇怪依赖问题。

我们开了工单:https://github.com/intuit/karate/issues/780

感谢您提供排除信息。如果您可以创建一个最小的快速入门来复制它(并提及您的 JDK 版本),那将会有所帮助。

关于java - 包含导致 SpringRunner contextLoad 错误的 com.intuit.karate 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56193195/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com