私はhttp://www.javainuse.com/spring/spring-cloud-netflix-zuul-tutorialからコードを開発していますが、まだカスタマイズされていません。下記のエラーが引き続き発生します。そこで、このエラーを回避するために、application.properties
ファイル。
eureka.client.registerWithEureka=false
eureka.client.fetchRegistry=false
eureka.client.server.waitTimeInMsWhenSyncEmpty=0
上記のプロパティを追加した瞬間、エラーは発生しません。
参考のために以下のエラー
com.Sun.jersey.api.client.ClientHandlerException: Java.net.ConnectException: Connection refused: connect
at com.Sun.jersey.client.Apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.Java:187) ~[jersey-Apache-client4-1.19.1.jar:1.19.1]
at com.Sun.jersey.api.client.filter.GZIPContentEncodingFilter.handle(GZIPContentEncodingFilter.Java:123) ~[jersey-client-1.19.1.jar:1.19.1]
at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.Java:27) ~[eureka-client-1.4.12.jar:1.4.12]
at com.Sun.jersey.api.client.Client.handle(Client.Java:652) ~[jersey-client-1.19.1.jar:1.19.1]
at com.Sun.jersey.api.client.WebResource.handle(WebResource.Java:682) ~[jersey-client-1.19.1.jar:1.19.1]
at com.Sun.jersey.api.client.WebResource.access$200(WebResource.Java:74) ~[jersey-client-1.19.1.jar:1.19.1]
at com.Sun.jersey.api.client.WebResource$Builder.get(WebResource.Java:509) ~[jersey-client-1.19.1.jar:1.19.1]
at com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.getApplicationsInternal(AbstractJerseyEurekaHttpClient.Java:194) ~[eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.getApplications(AbstractJerseyEurekaHttpClient.Java:165) ~[eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.Java:137) [eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.decorator.MetricsCollectingEurekaHttpClient.execute(MetricsCollectingEurekaHttpClient.Java:73) ~[eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.Java:134) [eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.Java:137) [eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.executeOnNewServer(RedirectingEurekaHttpClient.Java:118) ~[eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.execute(RedirectingEurekaHttpClient.Java:79) ~[eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.Java:134) [eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.Java:137) [eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.Java:119) [eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.Java:134) [eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.Java:137) [eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.Java:77) [eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.Java:134) [eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry(DiscoveryClient.Java:1030) [eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.Java:944) [eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.Java:444) [eureka-client-1.4.12.jar:1.4.12]
at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.Java:304) [eureka-client-1.4.12.jar:1.4.12]
at org.springframework.cloud.netflix.eureka.CloudEurekaClient.<init>(CloudEurekaClient.Java:51) [spring-cloud-netflix-eureka-client-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.Java:192) [spring-cloud-netflix-eureka-client-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration$$EnhancerBySpringCGLIB$$302e4429.CGLIB$eurekaClient$0(<generated>) [spring-cloud-netflix-eureka-client-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration$$EnhancerBySpringCGLIB$$302e4429$$FastClassBySpringCGLIB$$829e6899.invoke(<generated>) [spring-cloud-netflix-eureka-client-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.Java:228) [spring-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.Java:358) [spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration$$EnhancerBySpringCGLIB$$302e4429.eurekaClient(<generated>) [spring-cloud-netflix-eureka-client-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
at Sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_161]
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_161]
at Java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_161]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.Java:162) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.Java:588) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.Java:1173) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.Java:1067) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.Java:513) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.Java:483) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.Java:345) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.Java:359) [spring-cloud-context-1.1.8.RELEASE.jar:1.1.8.RELEASE]
at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.Java:176) [spring-cloud-context-1.1.8.RELEASE.jar:1.1.8.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.Java:340) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.Java:197) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.Java:35) [spring-aop-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.Java:192) [spring-aop-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at com.Sun.proxy.$Proxy79.getApplications(Unknown Source) [na:na]
at org.springframework.cloud.netflix.eureka.server.EurekaServerConfiguration.peerAwareInstanceRegistry(EurekaServerConfiguration.Java:158) [spring-cloud-netflix-eureka-server-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.cloud.netflix.eureka.server.EurekaServerConfiguration$$EnhancerBySpringCGLIB$$f259bc3a.CGLIB$peerAwareInstanceRegistry$4(<generated>) [spring-cloud-netflix-eureka-server-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.cloud.netflix.eureka.server.EurekaServerConfiguration$$EnhancerBySpringCGLIB$$f259bc3a$$FastClassBySpringCGLIB$$c73a2430.invoke(<generated>) [spring-cloud-netflix-eureka-server-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.Java:228) [spring-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.Java:358) [spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.cloud.netflix.eureka.server.EurekaServerConfiguration$$EnhancerBySpringCGLIB$$f259bc3a.peerAwareInstanceRegistry(<generated>) [spring-cloud-netflix-eureka-server-1.2.6.RELEASE.jar:1.2.6.RELEASE]
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
at Sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_161]
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_161]
at Java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_161]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.Java:162) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.Java:588) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.Java:1173) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.Java:1067) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.Java:513) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.Java:483) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.Java:306) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.Java:230) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.Java:302) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.Java:202) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.Java:208) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.Java:1138) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.Java:1066) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.Java:835) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.Java:741) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.Java:467) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.Java:1173) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.Java:1067) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.Java:513) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.Java:483) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.Java:306) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.Java:230) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.Java:302) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.Java:202) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.Java:208) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.Java:1138) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.Java:1066) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.Java:585) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.Java:88) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.Java:366) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.Java:1264) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.Java:553) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.Java:483) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.Java:306) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.Java:230) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.Java:302) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.Java:197) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.Java:761) [spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.Java:866) [spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:542) [spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.Java:122) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.Java:737) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.Java:370) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:314) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:1162) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:1151) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at com.javainuse.EurekaServerApplication.main(EurekaServerApplication.Java:12) [classes/:na]
これらのプロパティを追加した瞬間、どのインスタンスも取得されません
registered with ureka and I client is getting end up with the below erorr
Exception in thread "main" Java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at Java.util.ArrayList.rangeCheck(Unknown Source)
at Java.util.ArrayList.get(Unknown Source)
at com.javainuse.controllers.ConsumerControllerClient.getEmployee(ConsumerControllerClient.Java:27)
at com.javainuse.SpringBootHelloWorldApplication.main(SpringBootHelloWorldApplication.Java:22)
私の質問は、この投稿で言及されている最初のエラーをどのように回避できるかということです。ガイドしてください。
問題は、Eurekaサーバーの正しいポートを指定していない可能性があります。ポートを指定しない場合、default port 808を使用しようとしますが、これはエラーにつながります。 application.propertiesファイルで以下に説明する構成を使用します。 8761はeurekaサーバーのデフォルトポートです
server.port=8761
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
また、以下のようにメインクラスに注釈を付けてください。
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
}
例外接続を拒否しました。バックグラウンドですでに実行されているサーバーのポート番号を意味します。バックグラウンドで実行されているサーバーのポート番号を確認します。
このプロセスに従ってください:
バックグラウンドで同じポート番号を実行している可能性があります。Windowsの以下のコマンドを参照して強制終了します。コマンドプロンプト->以下のコマンドを実行に移動し、
Find open running ports:
C:\WINDOWS\system32>netstat -ano | findstr :Port number
Example: netstat -ano | findstr :8761
kill ports based on PID(process ID)
C:\WINDOWS\system32>taskkill /PID PIDNumber /F
Example: taskkill /PID 3740 /F
上記のコマンドを使用して実行中のすべてのサービスを強制終了し、ポート番号を設定し、application.propertiesファイルに以下のコードを記述します。
server.port = 8761
#set port number
server.port=8761
eureka.client.register-with-eureka=false
eureka.client.fetchRegistry=false
eureka.client.server.waitTimeInMsWhenSyncEmpty=0
上記の行を編集するだけです。正常に動作しています。
EurekaServerは実行されていますか?
同じ問題がありました。問題は、Eureka Serverを実行していないことです。 Eureka Serverを実行した後、正常に動作し始めました。
このため、私はsetting.xmlファイルを使用してそれを解決しました。このファイルは、リポジトリフォルダーのすぐ下の.m2フォルダーに配置する必要があります。 m2 reposotoryのsetting.xmlファイル
1)単純なメモ帳でこのファイルを作成する必要があります。過去のコードは以下のとおりです。
<?xml version="1.0" encoding="UTF-8"?>
<settings
xmlns="http://maven.Apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.Apache.org/SETTINGS/1.0.0 http://maven.Apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups/>
<proxies>
<!-- Proxy for HTTP -->
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<Host>172.25.33.10</Host>
<port>8080</port>
<nonProxyHosts>local.net</nonProxyHosts>
</proxy>
<!-- Proxy for HTTPS -->
<proxy>
<id>optional</id>
<active>true</active>
<protocol>https</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<Host>172.25.33.10</Host>
<port>8080</port>
<nonProxyHosts>local.net</nonProxyHosts>
</proxy>
</proxies>
<servers/>
<mirrors/>
<profiles/>
</settings>
このファイルをsetting.xmlとして保存するより
リポジトリの下の.m2フォルダーに配置します
2)IDE(私はEclipseを使用しています)、windows-> preference-user setting-> browsing file path to setting.xml(C:\ Users\himanshun.m2\settings .xml)->更新設定をクリック->適用して閉じる