创建名称为 'bindingService' 的 bean 时出错 - Eureka & Bus AMQP
Error creating bean with name 'bindingService' - Eureka & Bus AMQP
我正在尝试将 Hystrix 集成到我当前的 spring-cloud & Netflix OSS 微服务项目中。
我有一个新的 Spring 引导版本 1.4。0.RELEASE 项目有两个依赖项:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
在项目启动时我收到此异常:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bindingService' defined in class path resource [org/springframework/cloud/stream/config/ChannelBindingServiceConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.stream.binding.ChannelBindingService]: Factory method 'bindingService' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/validation/Validator
仅当 Eureka 和 Bus AMQP 依赖项在一起时才会出现此异常。
应用程序中没有设置配置或bootstrap.yml/.properties。
目前唯一的 Java class 是由 Spring Boot:
生成的
@SpringBootApplication
public class DummyProjectApplication {
public static void main(String[] args) {
SpringApplication.run(DummyProjectApplication.class, args);
}
}
完整 POM:
<?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.dummy</groupId>
<artifactId>dummy_project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>dummy_project</name>
<description>dummy_project</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.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.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR4</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>
完整堆栈跟踪:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bindingService' defined in class path resource [org/springframework/cloud/stream/config/ChannelBindingServiceConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.stream.binding.ChannelBindingService]: Factory method 'bindingService' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/validation/Validator
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at com.dummy.DummyProjectApplication.main(DummyProjectApplication.java:10) [classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.stream.binding.ChannelBindingService]: Factory method 'bindingService' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/validation/Validator
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
... 18 common frames omitted
Caused by: java.lang.NoClassDefFoundError: javax/validation/Validator
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_73]
at java.lang.ClassLoader.defineClass(Unknown Source) ~[na:1.8.0_73]
at java.security.SecureClassLoader.defineClass(Unknown Source) ~[na:1.8.0_73]
at java.net.URLClassLoader.defineClass(Unknown Source) ~[na:1.8.0_73]
at java.net.URLClassLoader.access0(Unknown Source) ~[na:1.8.0_73]
at java.net.URLClassLoader.run(Unknown Source) ~[na:1.8.0_73]
at java.net.URLClassLoader.run(Unknown Source) ~[na:1.8.0_73]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_73]
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at org.springframework.cloud.stream.binding.ChannelBindingService.<init>(ChannelBindingService.java:71) ~[spring-cloud-stream-1.0.2.RELEASE.jar:1.0.2.RELEASE]
at org.springframework.cloud.stream.config.ChannelBindingServiceConfiguration.bindingService(ChannelBindingServiceConfiguration.java:105) ~[spring-cloud-stream-1.0.2.RELEASE.jar:1.0.2.RELEASE]
at org.springframework.cloud.stream.config.ChannelBindingServiceConfiguration$$EnhancerBySpringCGLIB$$dcfa32f2.CGLIB$bindingService(<generated>) ~[spring-cloud-stream-1.0.2.RELEASE.jar:1.0.2.RELEASE]
at org.springframework.cloud.stream.config.ChannelBindingServiceConfiguration$$EnhancerBySpringCGLIB$$dcfa32f2$$FastClassBySpringCGLIB$1fb65d.invoke(<generated>) ~[spring-cloud-stream-1.0.2.RELEASE.jar:1.0.2.RELEASE]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.cloud.stream.config.ChannelBindingServiceConfiguration$$EnhancerBySpringCGLIB$$dcfa32f2.bindingService(<generated>) ~[spring-cloud-stream-1.0.2.RELEASE.jar:1.0.2.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_73]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
... 19 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.validation.Validator
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
... 43 common frames omitted
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
我觉得java.lang.NoClassDefFoundError: javax/validation/Validator
应该是个线索。 class 不包含在两个(看起来很奇怪的)依赖项中。我们可以坐下来讨论是否应该包含它,或者您可以自己包含它(例如通过 spring-boot-starter-web
,这是通常的来源,或者 spring-boot-starter-validation
如果您不需要网络内容)。 =13=]
我正在尝试将 Hystrix 集成到我当前的 spring-cloud & Netflix OSS 微服务项目中。
我有一个新的 Spring 引导版本 1.4。0.RELEASE 项目有两个依赖项:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
在项目启动时我收到此异常:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bindingService' defined in class path resource [org/springframework/cloud/stream/config/ChannelBindingServiceConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.stream.binding.ChannelBindingService]: Factory method 'bindingService' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/validation/Validator
仅当 Eureka 和 Bus AMQP 依赖项在一起时才会出现此异常。
应用程序中没有设置配置或bootstrap.yml/.properties。
目前唯一的 Java class 是由 Spring Boot:
生成的@SpringBootApplication
public class DummyProjectApplication {
public static void main(String[] args) {
SpringApplication.run(DummyProjectApplication.class, args);
}
}
完整 POM:
<?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.dummy</groupId>
<artifactId>dummy_project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>dummy_project</name>
<description>dummy_project</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.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.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Brixton.SR4</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>
完整堆栈跟踪:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bindingService' defined in class path resource [org/springframework/cloud/stream/config/ChannelBindingServiceConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.stream.binding.ChannelBindingService]: Factory method 'bindingService' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/validation/Validator
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE]
at com.dummy.DummyProjectApplication.main(DummyProjectApplication.java:10) [classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.stream.binding.ChannelBindingService]: Factory method 'bindingService' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/validation/Validator
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
... 18 common frames omitted
Caused by: java.lang.NoClassDefFoundError: javax/validation/Validator
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_73]
at java.lang.ClassLoader.defineClass(Unknown Source) ~[na:1.8.0_73]
at java.security.SecureClassLoader.defineClass(Unknown Source) ~[na:1.8.0_73]
at java.net.URLClassLoader.defineClass(Unknown Source) ~[na:1.8.0_73]
at java.net.URLClassLoader.access0(Unknown Source) ~[na:1.8.0_73]
at java.net.URLClassLoader.run(Unknown Source) ~[na:1.8.0_73]
at java.net.URLClassLoader.run(Unknown Source) ~[na:1.8.0_73]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_73]
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at org.springframework.cloud.stream.binding.ChannelBindingService.<init>(ChannelBindingService.java:71) ~[spring-cloud-stream-1.0.2.RELEASE.jar:1.0.2.RELEASE]
at org.springframework.cloud.stream.config.ChannelBindingServiceConfiguration.bindingService(ChannelBindingServiceConfiguration.java:105) ~[spring-cloud-stream-1.0.2.RELEASE.jar:1.0.2.RELEASE]
at org.springframework.cloud.stream.config.ChannelBindingServiceConfiguration$$EnhancerBySpringCGLIB$$dcfa32f2.CGLIB$bindingService(<generated>) ~[spring-cloud-stream-1.0.2.RELEASE.jar:1.0.2.RELEASE]
at org.springframework.cloud.stream.config.ChannelBindingServiceConfiguration$$EnhancerBySpringCGLIB$$dcfa32f2$$FastClassBySpringCGLIB$1fb65d.invoke(<generated>) ~[spring-cloud-stream-1.0.2.RELEASE.jar:1.0.2.RELEASE]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
at org.springframework.cloud.stream.config.ChannelBindingServiceConfiguration$$EnhancerBySpringCGLIB$$dcfa32f2.bindingService(<generated>) ~[spring-cloud-stream-1.0.2.RELEASE.jar:1.0.2.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_73]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_73]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_73]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_73]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
... 19 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.validation.Validator
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
... 43 common frames omitted
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
我觉得java.lang.NoClassDefFoundError: javax/validation/Validator
应该是个线索。 class 不包含在两个(看起来很奇怪的)依赖项中。我们可以坐下来讨论是否应该包含它,或者您可以自己包含它(例如通过 spring-boot-starter-web
,这是通常的来源,或者 spring-boot-starter-validation
如果您不需要网络内容)。 =13=]