使用cxf-jaxrs
,spring boot和maven在Spring工具套件上运行Restful Web服务应用程序时出现以下错误。
我正在使用以下内容: -
STS-3.9.0 release
jdk-1.8.0-25
Eclipse - oxygen
日志:请查找完整的日志。
. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.5.13.RELEASE) 2018-05-12 21:00:20.545 INFO 7832 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication on
D1Y89H52,带PID 7832 (C:\用户\莫妮卡\文件\工作空间STS-3.9.0.RELEASE \演示\目标\类 由monika开始 C:\ Users \用户莫妮卡\文件\工作空间STS-3.9.0.RELEASE \演示) 2018-05-12 21:00:20.549 INFO 7832 --- [main] com.example.demo.DemoApplication:没有活动的配置文件集, 回退到默认配置文件:默认 2018-05-12 21:00:20.608 INFO 7832 --- [main] s.c.a.AnnotationConfigApplicationContext:Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@2bea5ab4: 启动日期[星期六5月12日21:00:20 IST 2018];上下文层次结构的根 2018-05-12 21:00:20.636 ERROR 7832 --- [main] o.s.boot.SpringApplication:应用程序启动失败 -2018-05-1221:00:20.545INFO7832 --- [main] com.example.demo.DemoApplication:StartingDemoApplication onD1Y89H52withPID7832 (C:\用户\莫妮卡\文件\工作空间STS-3.9.0.RELEASE \演示\目标\类 startedbymonikain C:\ Users \用户莫妮卡\文件\工作空间STS-3.9.0.RELEASE \演示) 2018-05-1221:00:20.549INFO7832 --- [主要] com.example.demo.DemoApplication:Noactiveprofileset, fallingbacktodefaultprofiles:default2018-05-1221:00:20.608 INFO7832 --- [main] s.c.a.AnnotationConfigApplicationContext:刷新 org.springframework.context.annotation.AnnotationConfigApplicationContext@2bea5ab4: startupdate [SatMay1221:00:20IST2018]; rootofcontext hierarchy2018-05-1221:00:20.636ERROR7832 --- [主要] o.s.boot.SpringApplication:Applicationstartupfailed java.lang.NoClassDefFoundError: org / springframework / expression / ParserContext at java.lang.ClassLoader.defineClass1(NativeMethod)〜[na:1.8.0_102] at at java.lang.ClassLoader.defineClass(UnknownSource)〜[na:1.8.0_102] at at java.security.SecureClassLoader.defineClass(UnknownSource) 〜[na:1.8.0_102] atjava.net.URLClassLoader.defineClass(未知 来源)〜[na:1.8.0_102] at java.net.URLClassLoader.access $ 100(UnknownSource)〜[NA:1.8.0_102] atjava.net.URLClassLoader $ 1.run(UnknownSource)〜[na:1.8.0_102] at at java.net.URLClassLoader $ 1.run(UnknownSource)〜[na:1.8.0_102] at at java.security.AccessController.doPrivileged(NativeMethod) 〜[na:1.8.0_102] atjava.net.URLClassLoader.findClass(UnknownSource) 〜[na:1.8.0_102] atjava.lang.ClassLoader.loadClass(UnknownSource) 〜[na:1.8.0_102] at sun.misc.Launcher $ AppClassLoader.loadClass(UnknownSource)〜
[na:1.8.0_102] at java.lang.ClassLoader.loadClass(Unknown Source) 〜[na:1.8.0_102] at org.springframework.context.expression.StandardBeanExpressionResolver。(StandardBeanExpressionResolver.java:69) 〜[spring-context-4.3.17.RELEASE.jar:4.3.17.RELEASE] at org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:630) 〜[spring-context-4.3.17.RELEASE.jar:4.3.17.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:518) 〜[弹簧上下文4.3.17.RELEASE.jar:4.3.17.RELEASE] atorg.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.13.RELEASE.jar:1.5.13.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.13.RELEASE.jar:1.5.13.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.13.RELEASE.jar:1.5.13.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.13.RELEASE.jar:1.5.13.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.13.RELEASE.jar:1.5.13.RELEASE] at com.example.demo.DemoApplication.main(DemoApplication.java:10) [classes /:na]引起:java.lang.ClassNotFoundException: org.springframework.expression.ParserContext at java.net.URLClassLoader.findClass(未知来源)〜[na:1.8.0_102] at at java.lang.ClassLoader.loadClass(Unknown Source)〜[na:1.8.0_102] at sun.misc.Launcher $ AppClassLoader.loadClass(未知来源) 〜[na:1.8.0_102] at java.lang.ClassLoader.loadClass(Unknown Source) 〜[na:1.8.0_102] ...省略了21个共同帧2018-05-12 21:00:20.638 INFO 7832 --- [main] s.c.a.AnnotationConfigApplicationContext: 闭幕 org.springframework.context.annotation.AnnotationConfigApplicationContext@2bea5ab4: 启动日期[星期六5月12日21:00:20 IST 2018];背景的根源
的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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.13.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
<version>3.1.11</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
答案 0 :(得分:0)
尝试添加spring-expression
依赖项:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>whatever ver. is comatible with your ver. of spring boot</version>
</dependency>
或者
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
可能会带来缺失的依赖关系。