微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

AWS EC2上的Spring Eureka

如何解决AWS EC2上的Spring Eureka

Spring Eureka的新手。经过很多问题之后,让Spring Eureka可以在我的本地计算机上运行,​​但是使其可以在AWS EC2上运行-AMI1实例是另外一回事了,并且不会停止发出错误消息。

  • 只有1个区域:us-east-2
  • 不存在ALB或NLB
  • 提供了SSL证书(DNS:eureka.mydomain.com)
  • SG组具有用于8761端口的自定义TCP
#
# Spring Properties
#
spring:
  application:
    name:app-eureka-server
  security:
    user:
      name: foo
      password: bar
      roles: ADMIN
  cloud:
    loadbalancer:
      ribbon:
        enabled: false
#
# Server Properties
# 
server:
  port: 8761
  address: ec2-1.us-east-2.compute.amazonaws.com
#
# SSL Configurations
# 
  ssl:
    enabled: true
    key-store: classpath:keystore.p12
    key-store-password: password
    key-store-type: PKCS12
    key-alias: tomcat
#
# Eureka
#
eureka:
  server:
    enable-self-preservation: true
    eviction-interval-timer-in-ms: 5000
    a-w-s-access-id: ACCESS
    a-w-s-secret-key: SECRET
  client:
    healthcheck:
      enabled: true
    register-with-eureka: false
    fetch-registry: false
    eureka-server-d-n-s-name: eureka.${eureka.instance.app-group-name}.com
    use-dns-for-fetching-service-urls: false
    eureka-server-u-r-l-context: eureka
    service-url:
#      us-east-2a: https://${spring.security.user.name}:${spring.security.user.password}@${eureka.instance.hostname}:${server.port}/${eureka.client.eureka-server-u-r-l-context}
#      us-east2b: https://${spring.security.user.name}:${spring.security.user.password}@${eureka.instance.hostname}:${server.port}/${eureka.client.eureka-server-u-r-l-context}
#      us-east-2c: https://${spring.security.user.name}:${spring.security.user.password}@${eureka.instance.hostname}:${server.port}/${eureka.client.eureka-server-u-r-l-context}
      defaultZone: https://${spring.security.user.name}:${spring.security.user.password}@${eureka.instance.hostname}:${server.port}/${eureka.client.eureka-server-u-r-l-context}
    region: us-east-2
    prefer-same-zone-eureka: true
    availability-zones:
      us-east-2: defaultZone
  instance:
#    hostname: ${server.address}
    non-secure-port-enabled: false
    secure-port-enabled: true
    statusPageUrl: https://${eureka.instance.hostname}/info
    healthCheckUrl: https://${eureka.instance.hostname}/health
    homePageUrl: https://${eureka.instance.hostname}/
    secure-port: ${server.port}
    app-group-name: shaadiuniverse
    

一对问题。

  1. 我正在通过instance设置EurekaInstanceConfigBean主机名,但是似乎没有注入或覆盖Yaml文件
@Configuration
@Profile("!default")
public class AWSInstanceConfig {
    @Bean
    public EurekaInstanceConfigBean eurekaInstanceConfigBean(InetUtils utils) {
       final EurekaInstanceConfigBean instance = new EurekaInstanceConfigBean(utils)
       {
         @Scheduled(initialDelay = 30000L,fixedrate = 30000L)
         public void refreshInfo() {
         AmazonInfo newInfo = AmazonInfo.Builder.newBuilder().autoBuild("eureka");
         if (!this.getDataCenterInfo().equals(newInfo)) {
           ((AmazonInfo) this.getDataCenterInfo()).setMetadata(newInfo.getMetadata());
           this.setHostname(newInfo.get(AmazonInfo.MetaDataKey.publicHostname));
           this.setIpAddress(newInfo.get(AmazonInfo.MetaDataKey.publicIpv4));
           this.setDataCenterInfo(newInfo);
           this.setSecurePort(8761);
         }
       }         
     };
     AmazonInfo info = AmazonInfo.Builder.newBuilder().autoBuild("eureka");
     instance.setHostname(info.get(AmazonInfo.MetaDataKey.publicHostname));
     instance.setIpAddress(info.get(AmazonInfo.MetaDataKey.publicIpv4));
     instance.setDataCenterInfo(info);
     instance.setSecurePort(8761);
     
     return instance;
    }
}
  1. 我似乎收到了AWS Credential异常
2020-09-27 16:50:26.794  INFO 30302 --- [      Thread-10] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka data center value eureka.datacenter is not set,defaulting to default
2020-09-27 16:50:26.795  INFO 30302 --- [      Thread-10] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka environment value eureka.environment is not set,defaulting to test
2020-09-27 16:50:26.863  INFO 30302 --- [      Thread-10] o.s.c.n.e.server.EurekaServerBootstrap   : isAws returned true
2020-09-27 16:50:26.882 ERROR 30302 --- [      Thread-10] o.s.c.n.e.server.EurekaServerBootstrap   : Cannot bootstrap eureka server :

java.lang.NoClassDefFoundError: com/amazonaws/auth/AWSCredentials
        at com.netflix.eureka.aws.AwsBinderDelegate.<init>(AwsBinderDelegate.java:29) ~[eureka-core-1.9.25.jar!/:1.9.25]
        at org.springframework.cloud.netflix.eureka.server.EurekaServerBootstrap.initEurekaServerContext(EurekaServerBootstrap.java:146) ~[spring-cloud-netflix-eureka-server-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
        at org.springframework.cloud.netflix.eureka.server.EurekaServerBootstrap.contextinitialized(EurekaServerBootstrap.java:84) ~[spring-cloud-netflix-eureka-server-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
        at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration.lambda$start$0(EurekaServerInitializerConfiguration.java:70) [spring-cloud-netflix-eureka-server-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
        at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_265]
Caused by: java.lang.classNotFoundException: com.amazonaws.auth.AWSCredentials
        at java.net.urlclassloader.findClass(urlclassloader.java:382) ~[na:1.8.0_265]
        at java.lang.classLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_265]
        at org.springframework.boot.loader.Launchedurlclassloader.loadClass(Launchedurlclassloader.java:151) ~[sp-eureka-dev.jar:0.0.1-SNAPSHOT]
        at java.lang.classLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_265]
        ... 5 common frames omitted

2020-09-27 16:50:26.883 ERROR 30302 --- [      Thread-10] e.s.EurekaServerInitializerConfiguration : Could not initialize Eureka servlet context

java.lang.RuntimeException: Cannot bootstrap eureka server :
        at org.springframework.cloud.netflix.eureka.server.EurekaServerBootstrap.contextinitialized(EurekaServerBootstrap.java:90) ~[spring-cloud-netflix-eureka-server-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
        at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration.lambda$start$0(EurekaServerInitializerConfiguration.java:70) ~[spring-cloud-netflix-eureka-server-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
        at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_265]
Caused by: java.lang.NoClassDefFoundError: com/amazonaws/auth/AWSCredentials
        at com.netflix.eureka.aws.AwsBinderDelegate.<init>(AwsBinderDelegate.java:29) ~[eureka-core-1.9.25.jar!/:1.9.25]
        at org.springframework.cloud.netflix.eureka.server.EurekaServerBootstrap.initEurekaServerContext(EurekaServerBootstrap.java:146) ~[spring-cloud-netflix-eureka-server-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
        at org.springframework.cloud.netflix.eureka.server.EurekaServerBootstrap.contextinitialized(EurekaServerBootstrap.java:84) ~[spring-cloud-netflix-eureka-server-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
        ... 2 common frames omitted
Caused by: java.lang.classNotFoundException: com.amazonaws.auth.AWSCredentials
        at java.net.urlclassloader.findClass(urlclassloader.java:382) ~[na:1.8.0_265]
        at java.lang.classLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_265]
        at org.springframework.boot.loader.Launchedurlclassloader.loadClass(Launchedurlclassloader.java:151) ~[sp-eureka-dev.jar:0.0.1-SNAPSHOT]
        at java.lang.classLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_265]
        ... 5 common frames omitted

2020-09-27 16:50:28.018  INFO 30302 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8761 (https) with context path ''
  1. 如果我删除eureka.instance.hostname,则会收到其他错误消息
2020-09-27 16:48:04.931  WARN 30071 --- [eerNodesUpdater] c.n.eureka.cluster.PeerEurekaNodes       : Cannot parse service URI https://foo:bar@${eureka.instance.hostname}:8761/eureka/

java.net.URISyntaxException: Illegal character in authority at index 8: https://foo:bar@${eureka.instance.hostname}:8761/eureka/
        at java.net.URI$Parser.fail(URI.java:2848) ~[na:1.8.0_265]
        at java.net.URI$Parser.parseAuthority(URI.java:3186) ~[na:1.8.0_265]
        at java.net.URI$Parser.parseHierarchical(URI.java:3097) ~[na:1.8.0_265]
        at java.net.URI$Parser.parse(URI.java:3053) ~[na:1.8.0_265]
        at java.net.URI.<init>(URI.java:588) ~[na:1.8.0_265]
        at com.netflix.eureka.cluster.PeerEurekaNodes.hostFromUrl(PeerEurekaNodes.java:261) [eureka-core-1.9.25.jar!/:1.9.25]
        at com.netflix.eureka.cluster.PeerEurekaNodes.isinstanceURL(PeerEurekaNodes.java:250) [eureka-core-1.9.25.jar!/:1.9.25]
        at com.netflix.eureka.cluster.PeerEurekaNodes.isThisMyUrl(PeerEurekaNodes.java:239) [eureka-core-1.9.25.jar!/:1.9.25]
        at com.netflix.eureka.cluster.PeerEurekaNodes.resolvePeerUrls(PeerEurekaNodes.java:138) [eureka-core-1.9.25.jar!/:1.9.25]
        at com.netflix.eureka.cluster.PeerEurekaNodes$2.run(PeerEurekaNodes.java:92) [eureka-core-1.9.25.jar!/:1.9.25]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_265]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_265]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_265]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_265]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_265]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_265]
        at java.lang.Thread.run(Thread.java:748) [na:1.8.0_265]

如果开始,在AWS IP的安全性页面上输入用户名和密码时,出现以下错误

2020-09-27 16:54:35.689  INFO 30302 --- [119-8761-exec-5] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring dispatcherServlet 'dispatcherServlet'
2020-09-27 16:54:35.690  INFO 30302 --- [119-8761-exec-5] o.s.web.servlet.dispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-09-27 16:54:35.704  INFO 30302 --- [119-8761-exec-5] o.s.web.servlet.dispatcherServlet        : Completed initialization in 14 ms
2020-09-27 16:54:41.564 ERROR 30302 --- [119-8761-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing Failed; nested exception is java.lang.NullPointerException] with root cause

java.lang.NullPointerException: null
        at org.springframework.cloud.netflix.eureka.server.EurekaController.getServerContext(EurekaController.java:144) ~[spring-cloud-netflix-eureka-server-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
        at org.springframework.cloud.netflix.eureka.server.EurekaController.getRegistry(EurekaController.java:140) ~[spring-cloud-netflix-eureka-server-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
        at org.springframework.cloud.netflix.eureka.server.EurekaController.populateHeader(EurekaController.java:125) ~[spring-cloud-netflix-eureka-server-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
        at org.springframework.cloud.netflix.eureka.server.EurekaController.populateBase(EurekaController.java:114) ~[spring-cloud-netflix-eureka-server-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
        at org.springframework.cloud.netflix.eureka.server.EurekaController.status(EurekaController.java:68) ~[spring-cloud-netflix-eureka-server-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_265]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_265]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_265]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_265]
        at org.springframework.web.method.support.invocableHandlerMethod.doInvoke(invocableHandlerMethod.java:190) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.web.method.support.invocableHandlerMethod.invokeForRequest(invocableHandlerMethod.java:138) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.ServletinvocableHandlerMethod.invokeAndHandle(ServletinvocableHandlerMethod.java:105) ~[spring-webmvc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878) ~[spring-webmvc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792) ~[spring-webmvc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.web.servlet.dispatcherServlet.dodispatch(dispatcherServlet.java:1040) ~[spring-webmvc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.web.servlet.dispatcherServlet.doService(dispatcherServlet.java:943) ~[spring-webmvc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) ~[tomcat-embed-core-9.0.37.jar!/:4.0.FR]
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) ~[tomcat-embed-core-9.0.37.jar!/:4.0.FR]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:155) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.authentication.ui.DefaultlogoutPageGeneratingFilter.doFilterInternal(DefaultlogoutPageGeneratingFilter.java:52) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:216) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.authentication.logout.logoutFilter.doFilter(logoutFilter.java:116) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) ~[spring-security-web-5.3.3.RELEASE.jar!/:5.3.3.RELEASE]
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.springframework.boot.actuate.metrics.web.servlet.WebMvcmetricsFilter.doFilterInternal(WebMvcmetricsFilter.java:93) ~[spring-boot-actuator-2.3.2.RELEASE.jar!/:2.3.2.RELEASE]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.8.RELEASE.jar!/:5.2.8.RELEASE]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at org.apache.tomcat.util.net.socketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_265]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_265]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
        at java.lang.Thread.run(Thread.java:748) [na:1.8.0_265]

试图找出出什么问题是对的。我也没有看到有关Eureka在AWS EC2中工作的大量文档。工作中的至少一位。尝试了几乎所有东西。

编辑:添加POM.xml

    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Hoxton.SR7</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </dependency>
        <!-- Exclude aws-java-sdk-core -->
        <!-- <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-starter-aws</artifactId>
          <exclusions>
            <exclusion>
              <groupId>com.amazonaws</groupId>
              <artifactId>aws-java-sdk-core</artifactId>
            </exclusion>
          </exclusions>
        </dependency> -->
        <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.security</groupId>
            <artifactId>spring-security-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>
                <configuration>
                    <executable>true</executable>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。