无法通过eureka客户端运行服务。它因“无法创建Jersey客户端”错误而中断]] << [

问题描述 投票:0回答:1
由于错误“无法创建泽西岛客户端”而无法运行eureka客户端

我有一个服务'insureconnect',它是此spring-auth服务的依赖项。如果我在没有确保connect的情况下运行spring-auth,那么它将起作用。我在insureconnect中有一些在spring-auth中引用的类。 Eureka服务器在8761端口上正常运行。如果我尝试运行spring-auth,则使用Insureconnect会中断

spring-auth服务的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.eureka.auth</groupId> <artifactId>spring-eureka-auth</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>spring-eureka-auth</name> <description>Demo project for Spring Boot Cloud</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.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> <spring-cloud.version>Finchley.M9</spring-cloud.version> </properties> <dependencies> <dependency> <groupId>com.metamorphosys.insureconnect</groupId> <artifactId>InsureConnect</artifactId> <version>1.0.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>0.9.0</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> <!-- <dependency> <groupId>com.eureka.common</groupId> <artifactId>spring-eureka-common</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.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> <repositories> <repository> <id>spring-milestones</id> <name>Spring Milestones</name> <url>https://repo.spring.io/milestone</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> </project>

spring-auth的application.properties:

spring.application.name=auth-service server.port=9100 eureka.client.service-url.default-zone=http://localhost:8761/eureka #masterdb config SQL master.spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver master.spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=MMS_Phase2 master.hibernate.default_schema=dbo master.spring.datasource.username=sa master.spring.datasource.password=root master.spring.datasource.test-while-idle=true master.spring.datasource.validation-query=SELECT 1 #master.spring.datasource.testWhileIdle = true #master.spring.datasource.validationQuery = SELECT 1 #transactiondb config SQL primary.spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver primary.spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=MMS_Phase2 primary.hibernate.default_schema=dbo primary.spring.datasource.username=sa primary.spring.datasource.password=root

spring-auth引导类

package com.eureka.auth; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.context.annotation.ComponentScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @SpringBootApplication(scanBasePackages ={"com.eureka.auth","com.metamorphosys.insureconnect"}) //@ComponentScan({"com.eureka.auth","com.metamorphosys"}) //@EntityScan("com.delivery.domain") //@EnableJpaRepositories("com.delivery.repository") @EnableEurekaClient public class SpringEurekaAuthApp { public static void main(String[] args) { SpringApplication.run(SpringEurekaAuthApp.class, args); } }

以下是我得到的错误:

26-04-2019 11:53:01.164 [35m[restartedMain][0;39m [34mINFO [0;39m org.springframework.context.support.DefaultLifecycleProcessor.start - Starting beans in phase 0 26-04-2019 11:53:01.181 [35m[restartedMain][0;39m [34mINFO [0;39m org.springframework.cloud.netflix.eureka.InstanceInfoFactory.create - Setting initial instance status as: STARTING 26-04-2019 11:53:01.306 [35m[restartedMain][0;39m [34mINFO [0;39m com.netflix.discovery.DiscoveryClient.<init> - Initializing Eureka in region us-east-1 26-04-2019 11:53:01.757 [35m[restartedMain][0;39m [34mINFO [0;39m com.netflix.discovery.provider.DiscoveryJerseyProvider.<init> - Using JSON encoding codec LegacyJacksonJson 26-04-2019 11:53:01.757 [35m[restartedMain][0;39m [34mINFO [0;39m com.netflix.discovery.provider.DiscoveryJerseyProvider.<init> - Using JSON decoding codec LegacyJacksonJson 26-04-2019 11:53:02.323 [35m[restartedMain][0;39m [34mINFO [0;39m com.netflix.discovery.provider.DiscoveryJerseyProvider.<init> - Using XML encoding codec XStreamXml 26-04-2019 11:53:02.323 [35m[restartedMain][0;39m [34mINFO [0;39m com.netflix.discovery.provider.DiscoveryJerseyProvider.<init> - Using XML decoding codec XStreamXml 26-04-2019 11:53:02.395 [35m[restartedMain][0;39m [1;31mERROR[0;39m org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getEurekaClient - error getting CloudEurekaClient org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.eurekaClient' defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.discovery.EurekaClient]: Factory method 'eurekaClient' threw exception; nested exception is java.lang.RuntimeException: Failed to initialize DiscoveryClient! at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1250) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:348) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:384) ~[spring-cloud-context-2.0.0.M9.jar:2.0.0.M9] at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:183) ~[spring-cloud-context-2.0.0.M9.jar:2.0.0.M9] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:345) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35) ~[spring-aop-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getTargetObject(EurekaRegistration.java:167) ~[spring-cloud-netflix-eureka-client-2.0.0.M8.jar:2.0.0.M8] at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getEurekaClient(EurekaRegistration.java:156) ~[spring-cloud-netflix-eureka-client-2.0.0.M8.jar:2.0.0.M8] at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.maybeInitializeClient(EurekaServiceRegistry.java:57) [spring-cloud-netflix-eureka-client-2.0.0.M8.jar:2.0.0.M8] at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.register(EurekaServiceRegistry.java:39) [spring-cloud-netflix-eureka-client-2.0.0.M8.jar:2.0.0.M8] at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration.start(EurekaAutoServiceRegistration.java:80) [spring-cloud-netflix-eureka-client-2.0.0.M8.jar:2.0.0.M8] at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) [spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:52) [spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) [spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:157) [spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:121) [spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:884) [spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) [spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at com.eureka.auth.SpringEurekaAuthApp.main(SpringEurekaAuthApp.java:18) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.0.0.RELEASE.jar:2.0.0.RELEASE] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.discovery.EurekaClient]: Factory method 'eurekaClient' threw exception; nested exception is java.lang.RuntimeException: Failed to initialize DiscoveryClient! at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE] ... 35 common frames omitted Caused by: java.lang.RuntimeException: Failed to initialize DiscoveryClient! at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:411) ~[eureka-client-1.8.7.jar:1.8.7] at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:269) ~[eureka-client-1.8.7.jar:1.8.7] at org.springframework.cloud.netflix.eureka.CloudEurekaClient.<init>(CloudEurekaClient.java:63) ~[spring-cloud-netflix-eureka-client-2.0.0.M8.jar:2.0.0.M8] at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:269) ~[spring-cloud-netflix-eureka-client-2.0.0.M8.jar:2.0.0.M8] at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration$$EnhancerBySpringCGLIB$$94a20a6e.CGLIB$eurekaClient$1(<generated>) ~[spring-cloud-netflix-eureka-client-2.0.0.M8.jar:2.0.0.M8] at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration$$EnhancerBySpringCGLIB$$94a20a6e$$FastClassBySpringCGLIB$$12e2516e.invoke(<generated>) ~[spring-cloud-netflix-eureka-client-2.0.0.M8.jar:2.0.0.M8] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration$$EnhancerBySpringCGLIB$$94a20a6e.eurekaClient(<generated>) ~[spring-cloud-netflix-eureka-client-2.0.0.M8.jar:2.0.0.M8] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE] ... 36 common frames omitted Caused by: java.lang.RuntimeException: Cannot create Jersey client at com.netflix.discovery.shared.transport.jersey.EurekaJerseyClientImpl$EurekaJerseyClientBuilder.build(EurekaJerseyClientImpl.java:182) ~[eureka-client-1.8.7.jar:1.8.7] at com.netflix.discovery.shared.transport.jersey.JerseyEurekaHttpClientFactory$JerseyEurekaHttpClientFactoryBuilder.buildLegacy(JerseyEurekaHttpClientFactory.java:219) ~[eureka-client-1.8.7.jar:1.8.7] at com.netflix.discovery.shared.transport.jersey.JerseyEurekaHttpClientFactory$JerseyEurekaHttpClientFactoryBuilder.build(JerseyEurekaHttpClientFactory.java:194) ~[eureka-client-1.8.7.jar:1.8.7] at com.netflix.discovery.shared.transport.jersey.JerseyEurekaHttpClientFactory.create(JerseyEurekaHttpClientFactory.java:151) ~[eureka-client-1.8.7.jar:1.8.7] at com.netflix.discovery.shared.transport.jersey.Jersey1TransportClientFactories.newTransportClientFactory(Jersey1TransportClientFactories.java:59) ~[eureka-client-1.8.7.jar:1.8.7] at com.netflix.discovery.DiscoveryClient.scheduleServerEndpointTask(DiscoveryClient.java:485) ~[eureka-client-1.8.7.jar:1.8.7] at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:398) ~[eureka-client-1.8.7.jar:1.8.7] ... 49 common frames omitted Caused by: java.lang.RuntimeException: Cannot create Jersey client at com.netflix.discovery.shared.transport.jersey.EurekaJerseyClientImpl.<init>(EurekaJerseyClientImpl.java:61) ~[eureka-client-1.8.7.jar:1.8.7] at com.netflix.discovery.shared.transport.jersey.EurekaJerseyClientImpl$EurekaJerseyClientBuilder.build(EurekaJerseyClientImpl.java:180) ~[eureka-client-1.8.7.jar:1.8.7] ... 55 common frames omitted Caused by: java.lang.ExceptionInInitializerError: null at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:182) ~[jersey-core-1.19.1.jar:1.19.1] at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:175) ~[jersey-core-1.19.1.jar:1.19.1] at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:162) ~[jersey-core-1.19.1.jar:1.19.1] at com.sun.jersey.api.client.Client.init(Client.java:343) ~[jersey-client-1.19.1.jar:1.19.1] at com.sun.jersey.api.client.Client.access$000(Client.java:119) ~[jersey-client-1.19.1.jar:1.19.1] at com.sun.jersey.api.client.Client$1.f(Client.java:192) ~[jersey-client-1.19.1.jar:1.19.1] at com.sun.jersey.api.client.Client$1.f(Client.java:188) ~[jersey-client-1.19.1.jar:1.19.1] at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193) ~[jersey-core-1.19.1.jar:1.19.1] at com.sun.jersey.api.client.Client.<init>(Client.java:188) ~[jersey-client-1.19.1.jar:1.19.1] at com.sun.jersey.client.apache4.ApacheHttpClient4.<init>(ApacheHttpClient4.java:151) ~[jersey-apache-client4-1.19.1.jar:1.19.1] at com.sun.jersey.client.apache4.ApacheHttpClient4.<init>(ApacheHttpClient4.java:137) ~[jersey-apache-client4-1.19.1.jar:1.19.1] at com.sun.jersey.client.apache4.ApacheHttpClient4.create(ApacheHttpClient4.java:181) ~[jersey-apache-client4-1.19.1.jar:1.19.1] at com.netflix.discovery.shared.transport.jersey.EurekaJerseyClientImpl.<init>(EurekaJerseyClientImpl.java:53) ~[eureka-client-1.8.7.jar:1.8.7] ... 56 common frames omitted Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.glassfish.jersey.internal.RuntimeDelegateImpl at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:152) ~[javax.ws.rs-api-2.0.1.jar:2.0.1] at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:120) ~[javax.ws.rs-api-2.0.1.jar:2.0.1] at javax.ws.rs.core.MediaType.valueOf(MediaType.java:179) ~[javax.ws.rs-api-2.0.1.jar:2.0.1] at com.sun.jersey.core.header.MediaTypes.<clinit>(MediaTypes.java:65) ~[jersey-core-1.19.1.jar:1.19.1] ... 69 common frames omitted Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.internal.RuntimeDelegateImpl at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_131] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_131] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_131] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_131] at java.lang.Class.forName0(Native Method) ~[na:1.8.0_131] at java.lang.Class.forName(Class.java:264) ~[na:1.8.0_131] at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:115) ~[javax.ws.rs-api-2.0.1.jar:2.0.1] at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:225) ~[javax.ws.rs-api-2.0.1.jar:2.0.1] at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:135) ~[javax.ws.rs-api-2.0.1.jar:2.0.1] ... 72 common frames omitted 26-04-2019 11:53:02.411 [35m[restartedMain][0;39m [31mWARN [0;39m org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext.refresh - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'eurekaAutoServiceRegistration'; nested exception is java.lang.NullPointerException 26-04-2019 11:53:02.426 [35m[restartedMain][0;39m [34mINFO [0;39m com.netflix.discovery.DiscoveryClient.<init> - Initializing Eureka in region us-east-1 26-04-2019 11:53:02.426 [35m[restartedMain][0;39m [34mINFO [0;39m com.netflix.discovery.provider.DiscoveryJerseyProvider.<init> - Using JSON encoding codec LegacyJacksonJson 26-04-2019 11:53:02.426 [35m[restartedMain][0;39m [34mINFO [0;39m com.netflix.discovery.provider.DiscoveryJerseyProvider.<init> - Using JSON decoding codec LegacyJacksonJson 26-04-2019 11:53:02.426 [35m[restartedMain][0;39m [34mINFO [0;39m com.netflix.discovery.provider.DiscoveryJerseyProvider.<init> - Using XML encoding codec XStreamXml 26-04-2019 11:53:02.426 [35m[restartedMain][0;39m [34mINFO [0;39m com.netflix.discovery.provider.DiscoveryJerseyProvider.<init> - Using XML decoding codec XStreamXml 26-04-2019 11:53:02.426 [35m[restartedMain][0;39m [31mWARN [0;39m org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod - Invocation of destroy method 'close' failed on bean with name 'eurekaRegistration': org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.eurekaClient' defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.discovery.EurekaClient]: Factory method 'eurekaClient' threw exception; nested exception is java.lang.RuntimeException: Failed to initialize DiscoveryClient! 26-04-2019 11:53:02.442 [35m[restartedMain][0;39m [34mINFO [0;39m org.springframework.jmx.export.annotation.AnnotationMBeanExporter.destroy - Unregistering JMX-exposed beans on shutdown 26-04-2019 11:53:02.442 [35m[restartedMain][0;39m [34mINFO [0;39m org.springframework.jmx.export.annotation.AnnotationMBeanExporter.unregisterBeans - Unregistering JMX-exposed beans 26-04-2019 11:53:02.536 [35m[restartedMain][0;39m [34mINFO [0;39m org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.destroy - Closing JPA EntityManagerFactory for persistence unit 'default' 26-04-2019 11:53:02.536 [35m[restartedMain][0;39m [34mINFO [0;39m org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.destroy - Closing JPA EntityManagerFactory for persistence unit 'default' 26-04-2019 11:53:02.536 [35m[restartedMain][0;39m [34mINFO [0;39m org.apache.catalina.core.StandardService.log - Stopping service [Tomcat] 26-04-2019 11:53:02.743 [35m[restartedMain][0;39m [34mINFO [0;39m org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener.logAutoConfigurationReport - Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 26-04-2019 11:53:02.743 [35m[restartedMain][0;39m [1;31mERROR[0;39m org.springframework.boot.SpringApplication.reportFailure - Application run failed org.springframework.context.ApplicationContextException: Failed to start bean 'eurekaAutoServiceRegistration'; nested exception is java.lang.NullPointerException at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:184) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:52) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:157) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:121) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:884) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at com.eureka.auth.SpringEurekaAuthApp.main(SpringEurekaAuthApp.java:18) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.0.0.RELEASE.jar:2.0.0.RELEASE] Caused by: java.lang.NullPointerException: null at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.maybeInitializeClient(EurekaServiceRegistry.java:57) ~[spring-cloud-netflix-eureka-client-2.0.0.M8.jar:2.0.0.M8] at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.register(EurekaServiceRegistry.java:39) ~[spring-cloud-netflix-eureka-client-2.0.0.M8.jar:2.0.0.M8] at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration.start(EurekaAutoServiceRegistration.java:80) ~[spring-cloud-netflix-eureka-client-2.0.0.M8.jar:2.0.0.M8] at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE] ... 19 common frames omitted [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:47 min [INFO] Finished at: 2019-04-26T11:53:02+05:30 [INFO] Final Memory: 48M/251M [INFO] ------------------------------------------------------------------------ FATAL ERROR in native method: JDWP on getting class status, jvmtiError=JVMTI_ERROR_WRONG_PHASE(112) JDWP exit error JVMTI_ERROR_WRONG_PHASE(112): on getting class status [util.c:1285]

无法运行eureka客户端,因为错误'无法创建Jersey客户端',我有一个服务'insureconnect',它是此spring-auth服务中的依赖项。如果我在不使用...的情况下运行spring-auth,则>] >> 

我意识到这是一个很晚的答案,但是如果其他任何人被引导到这里,那么我不需要球衣的解决方案就是从eureka-client中排除球衣依赖性:

<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> <exclusions> <exclusion> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> </exclusion> <exclusion> <groupId>com.sun.jersey</groupId> <artifactId>jersey-core</artifactId> </exclusion> <exclusion> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-apache-client4</artifactId> </exclusion> </exclusions> </dependency>

spring-boot spring-cloud-netflix
1个回答
0
投票
我意识到这是一个很晚的答案,但是如果其他任何人被引导到这里,那么我不需要球衣的解决方案就是从eureka-client中排除球衣依赖性:
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.