带有primefaces的spring引导给出错误:java.lang.NoClassDefFoundError:org



我是Spring boot的新手,我正在尝试使用STS IDE构建一个简单的带有素数的Spring boot项目。但是当我运行该程序时,我收到一个错误,如下所示:

2019-12-01 20:26:54.117 ERROR 5848 --- [           main] o.s.boot.SpringApplication               : 
Application run failed
java.lang.NoClassDefFoundError: org/springframework/core/log/LogMessage
at org.springframework.boot.StartupInfoLogger.logStarting(StartupInfoLogger.java:55) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.logStartupInfo(SpringApplication.java:637) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:373) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at com.AliasBlue.springbootjsf.application.JsfPrimefacesHello3Application.main(JsfPrimefacesHello3Application.java:10) ~[classes/:na]
Caused by: java.lang.ClassNotFoundException: org.springframework.core.log.LogMessage
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
... 7 common frames omitted

对于我的项目的pom.xml就是这样:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.Alias-Blue</groupId>
<artifactId>spring-boot-jsf</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>jsf-primefaces-hello-3</name>
<description>PCA_CFS project with Spring Boot </description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<joinfaces.version>4.0.1</joinfaces.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>

<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>primefaces-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</dependency>
</dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>joinfaces-dependencies</artifactId>
<version>${joinfaces.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

我按照这个网站的步骤操作:https://codenotfound.com/jsf-primefaces-example.html

使用的 Join Faces 的 4.0.1 版本依赖于 spring-boot-starter 2.1.1,而版本 2.2.1 已添加到 POM 中。这导致了java.lang.NoClassDefFoundError.

> 在 spring-boot-starter 2.1.1.RELEASE 上使用的 Join Faces 的 4.0.1 版

所以你可以使用 4.1.1 连接面作为弹簧引导启动器 2.2.1.发布 请检查下面的链接,你可以参考相应的spring-boot和joinfaces依赖组合。

https://mvnrepository.com/artifact/org.joinfaces/jsf-spring-boot-starter https://mvnrepository.com/artifact/org.joinfaces/jsf-spring-boot-starter/4.1.1

相关内容

  • 没有找到相关文章

最新更新