• SpringCloud启动eureka server报错ArrayStoreException,TypeNotPresentExceptionProxy


    SpringCloud启动eureka server报错ArrayStoreException,TypeNotPresentExceptionProxy

    今天搭建springcloud项目,启动eureka server服务报错,启动日志如下:

      .   ____          _            __ _ _
     /\ / ___'_ __ _ _(_)_ __  __ _    
    ( ( )\___ | '_ | '_| | '_ / _` |    
     \/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.3.1.RELEASE)
    
    2021-01-13 18:00:40.416  INFO 32948 --- [           main] c.i.c.d.eureka.EurekaServerApplication   : Starting EurekaServerApplication on MacBook-Pro-2.local with PID 32948 (/Users/dingzg/projects/cloud-job/cloud-job-demo/cloud-job-eureka-server/target/classes started by dingzg in /Users/dingzg/projects/cloud-job)
    2021-01-13 18:00:40.418  INFO 32948 --- [           main] c.i.c.d.eureka.EurekaServerApplication   : No active profile set, falling back to default profiles: default
    2021-01-13 18:00:40.918  WARN 32948 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.itlaonong.cloudjob.demo.eureka.EurekaServerApplication]; nested exception is java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
    2021-01-13 18:00:40.926  INFO 32948 --- [           main] ConditionEvaluationReportLoggingListener : 
    
    Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    2021-01-13 18:00:40.935 ERROR 32948 --- [           main] o.s.boot.SpringApplication               : Application run failed
    
    org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.itlaonong.cloudjob.demo.eureka.EurekaServerApplication]; nested exception is java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
    	at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:609) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassParser.access$800(ConfigurationClassParser.java:110) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.lambda$processGroupImports$1(ConfigurationClassParser.java:811) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at java.util.ArrayList.forEach(ArrayList.java:1249) ~[na:1.8.0_144]
    	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:808) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:779) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:192) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:319) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:280) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    	at com.itlaonong.cloudjob.demo.eureka.EurekaServerApplication.main(EurekaServerApplication.java:11) [classes/:na]
    Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
    	at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724) ~[na:1.8.0_144]
    	at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531) ~[na:1.8.0_144]
    	at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355) ~[na:1.8.0_144]
    	at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286) ~[na:1.8.0_144]
    	at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) ~[na:1.8.0_144]
    	at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) ~[na:1.8.0_144]
    	at java.lang.Class.createAnnotationData(Class.java:3521) ~[na:1.8.0_144]
    	at java.lang.Class.annotationData(Class.java:3510) ~[na:1.8.0_144]
    	at java.lang.Class.getDeclaredAnnotations(Class.java:3477) ~[na:1.8.0_144]
    	at org.springframework.core.annotation.AnnotationsScanner.getDeclaredAnnotations(AnnotationsScanner.java:499) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.core.annotation.AnnotationTypeMappings.addMetaAnnotationsToQueue(AnnotationTypeMappings.java:85) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.core.annotation.AnnotationTypeMappings.addAllMappings(AnnotationTypeMappings.java:79) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:68) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:46) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.core.annotation.AnnotationTypeMappings$Cache.createMappings(AnnotationTypeMappings.java:251) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:324) ~[na:1.8.0_144]
    	at org.springframework.core.annotation.AnnotationTypeMappings$Cache.get(AnnotationTypeMappings.java:247) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:204) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:186) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:173) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.core.annotation.TypeMappedAnnotation.of(TypeMappedAnnotation.java:597) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.core.annotation.MergedAnnotation.of(MergedAnnotation.java:610) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.core.type.classreading.MergedAnnotationReadingVisitor.visitEnd(MergedAnnotationReadingVisitor.java:96) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.asm.ClassReader.readElementValues(ClassReader.java:2985) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.asm.ClassReader.accept(ClassReader.java:582) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.asm.ClassReader.accept(ClassReader.java:401) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:49) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.createMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:86) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    	at org.springframework.boot.type.classreading.ConcurrentReferenceCachingMetadataReaderFactory.getMetadataReader(ConcurrentReferenceCachingMetadataReaderFactory.java:73) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:81) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:695) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getMemberClasses(ConfigurationClassParser.java:992) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassParser.processMemberClasses(ConfigurationClassParser.java:354) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:271) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:249) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:599) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    	... 20 common frames omitted
    
    
    Process finished with exit code 1
    

    寻找网上别人的经验,发现一篇可以借鉴的文章,同博主一样打断点调试,发现问题一样。基本确认是缺少依赖。随后检查pom文件,发现是依赖写错了。

    我pom文件写的是

            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-netflix-eureka-server</artifactId>
            </dependency>
    

    正确的应该是

            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
            </dependency>
    
  • 相关阅读:
    Spring AOP里的静态代理和动态代理,你真的了解嘛?
    redis的三种启动方式
    Linux MySQL分库分表之Mycat
    Linux 之Mycat搭建报错 java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException
    Linux MySQL Proxy 读写分离
    Linux MySQL集群搭建之主从复制
    Linux 虚拟机详细安装MySQL
    MySQL 性能优化细节
    MySQL 性能优化之慢查询
    MySQL事务处理
  • 原文地址:https://www.cnblogs.com/jimmyfan/p/14273512.html
Copyright © 2020-2023  润新知