gpt4 book ai didi

java - Spring Boot Spark 应用程序

转载 作者:行者123 更新时间:2023-12-01 14:17:39 28 4
gpt4 key购买 nike

我正在使用 Spring Boot 来实现一个 spark 应用程序。我构建了一个 uber jar,并使用 spark-submit 来执行应用程序。但是我得到了以下异常:

18/06/05 15:32:37 ERROR SpringApplication: Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gsonBuilder' defined in class path resource [org/springframework/boot/autoconfigure/gson/GsonAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.google.gson.GsonBuilder]: Factory method 'gsonBuilder' threw exception; nested exception is java.lang.BootstrapMethod

Error: java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1254) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1103) .....

即使我在我的 pom.xml 中添加以下依赖项,异常仍然存在:

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<scope>compile</scope>
</dependency>

我该如何解决这个依赖性问题?

最佳答案

也许你可以使用 @SpringBootApplication(exclude = {GsonAutoConfiguration.class}) 来禁用 gson 自动配置。

关于java - Spring Boot Spark 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50707880/

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