当前位置: 首页 > 知识库问答 >
问题:

启动Spring Boot应用程序时出现“Cassandra Cluster”bean异常

路欣荣
2023-03-14

我在启动Spring Boot应用程序时遇到以下异常。Spring Boot版本:2.1.13 Spring Framework版本:5.1.14

原因:原因:com.datastax.driver.core.exceptions.driverinternalerror:在类路径中检测到不兼容的Guava版本。你需要16.0.1或更高。在com.datastax.driver.core.guavacompatibility.selectimplementation(guavacompatibility.java:191)~[cassandra-driver-core.guavacompatibility.na]在com.datastax.driver.core.guavacompatibility.(guavacompatibility.java:59)~[cassandra-driver-core-3.6.0.jar:na]...省略了30个通用帧

但我在类路径中有Guava-19.0版本的jar。

我在使用Spring Boot 2.1.6和Spring Framework 5.1.5时没有遇到这个问题。

共有1个答案

阴凯歌
2023-03-14

在类路径上似乎有两个版本的番石榴。一些其他包可能会拉出其他版本。您应该在Maven的 部分(我希望您使用的是Maven):

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>19.0</version>
    </dependency>
 </dependencies>
</dependencyManagement>

或者将Guava依赖项从拉出它的其他依赖项中排除。

对未来的提示:考虑将Maven Enforcer插件添加到您的项目中,并检查依赖收敛以检查类似的问题:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>1.4.1</version>
            <executions>
                <execution>
                    <id>enforce</id>
                    <configuration>
                        <rules>
                            <DependencyConvergence/>
                        </rules>
                    </configuration>
                    <goals>
                        <goal>enforce</goal>
                    </goals>
                    <phase>validate</phase>
                </execution>
            </executions>
        </plugin>
    </plugins>
...
</build>
 类似资料:
  • 我的主 LoginController.java 请注意,我还没有在userController.java中编写任何代码,我只是为user.fxml编写了ui 在javafx.fxml.fxmlloader.constructloadexception(fxmlloader.java:2597)在javafx.fxml.fxmlloader.access$100(fxmlloader.java:1

  • 乍一看,这个问题似乎是重复的。我已经在谷歌搜索了一些,但不幸的是,没有一个结果不符合我。我给出了下面的问题链接。 应用程序启动方法java.lang.Reflect.InvocationTargetException JavaFX图像转换中出现异常 JavaFX-应用程序启动方法中的异常? 应用程序启动方法中出现异常 堆栈跟踪: 无法从此StackTrace跟踪错误。然后我在start方法中使用了

  • 我在stackoverflow上发现了类似的问题,并试图用这种方式(LINK)解决这个问题,但在我的项目中没有起作用。谁能给我一些建议吗? pom.xml 应用属性

  • 我刚刚开始使用JavaFX,我试图构建一个简单的应用程序,其中包含标签、文本字段和按钮,当单击这些按钮时,将标签的值设置为文本字段的值。在我把控制器连接到主文件之前,一切都很顺利。这是我的代码: 我尝试了在StackOverflow上找到的多个答案,但我找到的都是2年前的答案,对我的代码没有任何积极的影响。 编辑:在此处堆栈跟踪:

  • 得到 错误[SpringApplication]应用程序启动失败org.springframework.beans.factory.BeanCreationException:创建名称为myEntityManagerFactory的bean错误定义在类路径资源[com/员工/服务/配置/DBConfiguration.class]:调用init方法失败;嵌套异常是java.lang.NullPoi

  • 我尝试创建一个包含一个文本字段和按钮的屏幕,并重复“应用程序启动方法中的异常”。第一次我试着从这个问题中解题,但没有奏效: 应用程序启动方法中出现异常 应用程序启动方法javafx gui中出现异常 我使用Java11、JavaFX11。对于javaFx,我使用Maven。 主要的类别是: FXML文件为: