spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.87k stars 40.61k forks source link

spring boot application start up error #18190

Closed 13567436138 closed 5 years ago

13567436138 commented 5 years ago
2019-09-10 15:39:23.937 ERROR 5844 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.core.annotation.AnnotationConfigurationException: Attribute 'proxyBeanMethods' in annotation [org.springframework.boot.autoconfigure.SpringBootApplication] is declared as an @AliasFor nonexistent attribute 'proxyBeanMethods' in annotation [org.springframework.context.annotation.Configuration].
    at org.springframework.core.annotation.AnnotationTypeMapping.resolveAliasTarget(AnnotationTypeMapping.java:163) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMapping.resolveAliasTarget(AnnotationTypeMapping.java:134) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMapping.resolveAliasedForTargets(AnnotationTypeMapping.java:126) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMapping.<init>(AnnotationTypeMapping.java:103) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.addIfPossible(AnnotationTypeMappings.java:109) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.addAllMappings(AnnotationTypeMappings.java:68) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:61) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:46) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings$Cache.createMappings(AnnotationTypeMappings.java:217) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at java.base/java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:330) ~[na:na]
    at org.springframework.core.annotation.AnnotationTypeMappings$Cache.get(AnnotationTypeMappings.java:213) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:181) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:168) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.TypeMappedAnnotations$IsPresent.doWithAnnotations(TypeMappedAnnotations.java:330) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.TypeMappedAnnotations$IsPresent.doWithAnnotations(TypeMappedAnnotations.java:279) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.processClassHierarchy(AnnotationsScanner.java:211) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.processClassHierarchy(AnnotationsScanner.java:194) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.processClass(AnnotationsScanner.java:128) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.process(AnnotationsScanner.java:107) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.scan(AnnotationsScanner.java:97) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.scan(AnnotationsScanner.java:78) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.TypeMappedAnnotations.scan(TypeMappedAnnotations.java:242) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.core.annotation.TypeMappedAnnotations.isPresent(TypeMappedAnnotations.java:98) ~[spring-core-5.2.0.RC2.jar:5.1.2.RELEASE]
    at org.springframework.boot.BeanDefinitionLoader.isComponent(BeanDefinitionLoader.java:279) ~[classes/:na]
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:156) ~[classes/:na]
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:136) ~[classes/:na]
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:128) ~[classes/:na]
    at org.springframework.boot.SpringApplication.load(SpringApplication.java:691) ~[classes/:na]
    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:392) ~[classes/:na]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[classes/:na]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[classes/:na]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[classes/:na]
    at com.xkcoding.helloworld.SpringBootDemoHelloworldApplication.main(SpringBootDemoHelloworldApplication.java:28) ~[classes/:na]

Process finished with exit code 1
snicoll commented 5 years ago

@13567436138 this looks like a good candidate for a corrupted jar to me. If you're using maven, please run mvn dependency:purge-local-repository and try to download the bits again. If that doesn't work, we'll need a sample we can run ourselves that reproduces the issue

wilkinsona commented 5 years ago

Either that or you have mismatched Spring Framework jar files on the class path. proxyBeanMethods is new in 5.2 and I can see 5.1.2.RELEASE in some elements of the stack.

13567436138 commented 5 years ago

vn dependency:purge-local-repository not solve the problem

snicoll commented 5 years ago

As suggested by Andy, can you please make sure you don't have mixed jars on the classpath? mvn dependency:list -Dsort should show Spring Framework 5.2 (and not 5.1).

13567436138 commented 5 years ago

yes,you are right,thanks

wilkinsona commented 5 years ago

Thanks for letting us know.

Shiv-Kumar-Yadav9 commented 4 years ago

I am facing same issue. I changed my spring-boot dependency from 2.0.4.RELEASE to 2.2.5.RELEASE . Error faced is :

[ERROR] 2020-04-22 18:11:57.052 [main] [] SpringApplication - Application run failed
org.springframework.core.annotation.AnnotationConfigurationException: Attribute 'proxyBeanMethods' in annotation [org.springframework.boot.autoconfigure.SpringBootApplication] is declared as an @AliasFor nonexistent attribute 'proxyBeanMethods' in annotation [org.springframework.context.annotation.Configuration].
    at org.springframework.core.annotation.AnnotationTypeMapping.resolveAliasTarget(AnnotationTypeMapping.java:160) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMapping.resolveAliasTarget(AnnotationTypeMapping.java:131) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMapping.resolveAliasedForTargets(AnnotationTypeMapping.java:123) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMapping.<init>(AnnotationTypeMapping.java:100) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.addIfPossible(AnnotationTypeMappings.java:116) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.addAllMappings(AnnotationTypeMappings.java:75) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:68) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.<init>(AnnotationTypeMappings.java:46) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings$Cache.createMappings(AnnotationTypeMappings.java:251) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:324) ~[?:1.8.0_181]
    at org.springframework.core.annotation.AnnotationTypeMappings$Cache.get(AnnotationTypeMappings.java:247) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:204) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:186) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationTypeMappings.forAnnotationType(AnnotationTypeMappings.java:173) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.TypeMappedAnnotations$IsPresent.doWithAnnotations(TypeMappedAnnotations.java:330) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.TypeMappedAnnotations$IsPresent.doWithAnnotations(TypeMappedAnnotations.java:279) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.processClassHierarchy(AnnotationsScanner.java:216) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.processClassHierarchy(AnnotationsScanner.java:198) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.processClass(AnnotationsScanner.java:128) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.process(AnnotationsScanner.java:107) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.scan(AnnotationsScanner.java:97) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.AnnotationsScanner.scan(AnnotationsScanner.java:78) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.TypeMappedAnnotations.scan(TypeMappedAnnotations.java:242) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.core.annotation.TypeMappedAnnotations.isPresent(TypeMappedAnnotations.java:98) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
    at org.springframework.boot.BeanDefinitionLoader.isComponent(BeanDefinitionLoader.java:279) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:156) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:136) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:128) ~[spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at org.springframework.boot.SpringApplication.load(SpringApplication.java:691) [spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:392) [spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.5.RELEASE.jar:2.2.5.RELEASE]
    at com.xyz.eventprocessorengine.EventProcessorEngineApplication.main(EventProcessorEngineApplication.java:10) [classes/:?]

I checked my dependency tree and its only using Spring-Boot 2.2.5.RELEASE and Spring- Core uses 5.2.5.RELEASE version everywhere.

Shiv-Kumar-Yadav9 commented 4 years ago

Thanks for letting us know.

Hi Andy do you think there could be some other cause for this issue. Thanks.

wilkinsona commented 4 years ago

No, I don't think so. Note that org.springframework.context.annotation.Configuration is part of spring-context so you should check the version of that module as well.

Shiv-Kumar-Yadav9 commented 4 years ago

Voila, I had missed that. Thanks Andy.

kiranv1283 commented 4 years ago

I have faced the same issue but it solved by updating the below entry under main class. old: public static void main(String... args) { new: public static void main(String[] args) {

rfogel commented 3 years ago

Hello. I'm experience the same issue. Here's my dependecies:

org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.3.3.RELEASE:compile
org.springframework.boot:spring-boot-actuator:jar:2.3.3.RELEASE:compile
org.springframework.boot:spring-boot-autoconfigure:jar:2.3.3.RELEASE:compile
org.springframework.boot:spring-boot-devtools:jar:2.3.3.RELEASE:compile (optional)
org.springframework.boot:spring-boot-starter-actuator:jar:2.3.3.RELEASE:compile
org.springframework.boot:spring-boot-starter-aop:jar:2.3.3.RELEASE:compile
org.springframework.boot:spring-boot-starter-json:jar:2.3.3.RELEASE:compile
org.springframework.boot:spring-boot-starter-logging:jar:2.3.3.RELEASE:compile
org.springframework.boot:spring-boot-starter-test:jar:2.3.3.RELEASE:test
org.springframework.boot:spring-boot-starter-tomcat:jar:2.3.3.RELEASE:compile
org.springframework.boot:spring-boot-starter-validation:jar:2.3.3.RELEASE:compile
org.springframework.boot:spring-boot-starter-web:jar:2.3.3.RELEASE:compile
org.springframework.boot:spring-boot-starter:jar:2.3.3.RELEASE:compile
org.springframework.boot:spring-boot-test-autoconfigure:jar:2.3.3.RELEASE:test
org.springframework.boot:spring-boot-test:jar:2.3.3.RELEASE:test
org.springframework.boot:spring-boot:jar:2.3.3.RELEASE:compile
org.springframework.cloud:spring-cloud-commons:jar:2.2.5.RELEASE:compile
org.springframework.cloud:spring-cloud-config-client:jar:2.2.5.RELEASE:compile
org.springframework.cloud:spring-cloud-context:jar:2.2.5.RELEASE:compile
org.springframework.cloud:spring-cloud-function-context:jar:3.0.10.RELEASE:compile
org.springframework.cloud:spring-cloud-function-core:jar:3.0.10.RELEASE:compile
org.springframework.cloud:spring-cloud-schema-registry-client:jar:1.0.8.RELEASE:compile
org.springframework.cloud:spring-cloud-starter-config:jar:2.2.2.RELEASE:compile
org.springframework.cloud:spring-cloud-starter:jar:2.2.5.RELEASE:compile
org.springframework.cloud:spring-cloud-stream-binder-kafka-core:jar:3.0.10.RELEASE:compile
org.springframework.cloud:spring-cloud-stream-binder-kafka-streams:jar:3.0.11.BUILD-SNAPSHOT:compile
org.springframework.cloud:spring-cloud-stream-binder-kafka:jar:3.0.11.BUILD-SNAPSHOT:compile
org.springframework.cloud:spring-cloud-stream:jar:3.0.8.RELEASE:compile
org.springframework.data:spring-data-commons:jar:2.3.3.RELEASE:compile
org.springframework.data:spring-data-keyvalue:jar:2.3.3.RELEASE:compile
org.springframework.integration:spring-integration-core:jar:5.3.2.RELEASE:compile
org.springframework.integration:spring-integration-jmx:jar:5.3.2.RELEASE:compile
org.springframework.integration:spring-integration-kafka:jar:3.3.1.RELEASE:compile
org.springframework.kafka:spring-kafka-test:jar:2.6.3:test
org.springframework.kafka:spring-kafka:jar:2.5.5.RELEASE:compile
org.springframework.retry:spring-retry:jar:1.2.5.RELEASE:compile
org.springframework.security.kerberos:spring-security-kerberos-core:jar:1.0.1.RELEASE:compile
org.springframework.security:spring-security-core:jar:5.3.4.RELEASE:compile
org.springframework.security:spring-security-crypto:jar:5.3.4.RELEASE:compile
org.springframework.security:spring-security-rsa:jar:1.0.9.RELEASE:compile
org.springframework:spring-aop:jar:5.2.8.RELEASE:compile
org.springframework:spring-beans:jar:5.2.8.RELEASE:compile
org.springframework:spring-context:jar:5.2.8.RELEASE:compile
org.springframework:spring-core:jar:5.2.8.RELEASE:compile
org.springframework:spring-expression:jar:5.2.8.RELEASE:compile
org.springframework:spring-jcl:jar:5.2.8.RELEASE:compile
org.springframework:spring-messaging:jar:5.2.8.RELEASE:compile
org.springframework:spring-test:jar:5.2.8.RELEASE:test
org.springframework:spring-tx:jar:5.2.8.RELEASE:compile
org.springframework:spring-web:jar:5.2.8.RELEASE:compile
org.springframework:spring-webmvc:jar:5.2.8.RELEASE:compile

When I add the following dependency, the project starts to crash:

<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka-test</artifactId>

Ps: I already a mvn dependency:purge-local-repository but no success.

Thanks in advanced!

wilkinsona commented 3 years ago

@rfogel I can't see why adding spring-kafka-test would cause a problem. For the proxyBeanMethods attribute to be missing you must have an old spring-context jar on the classpath although I can't spot it in the output above. If you'd like some help figuring out what's wrong with your classpath, please ask a question on Stack Overflow and include a minimal, reproducible example with your question.

rfogel commented 3 years ago

@wilkinsona sorry for the delay. I think intelij did a mess with my classpath. Anyway, it's solved. Thanks for the help.

lloyd31 commented 2 years ago

To add to the list of symptoms. I was able to notice the issue with the usage of the maven assembly plugin. Getting rid of the same helped me launch the app without any issues.

Below was the assembly plugin usage.

<build>
    <finalName>SharedLibComponents</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <appendAssemblyId>false</appendAssemblyId>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id> 
                    <phase>package</phase> 
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
gouravkrosx commented 2 years ago

I am getting the same error. SpringBoot version: 2.2.0.RELEASE Spring version: 5.1.1.RELEASE

                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>shade-my-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <manifestEntries>
                                        <Main-Class>com.javatechie.es.api.SpringBootElasticserachExampleApplication</Main-Class>
                                    </manifestEntries>
                                </transformer>
                            </transformers>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

I am using the above plugin in my pom.xml and I can't remove this as it is required.

wilkinsona commented 2 years ago

@gouravkrosx OSS support for Spring Boot 2.2.0.RELEASE ended almost 2 years ago. It also requires Spring Framework 5.2. You should upgrade to Spring Boot 2.6.x or 2.7.x as soon as you can.

gouravkrosx commented 2 years ago

@gouravkrosx OSS support for Spring Boot 2.2.0.RELEASE ended almost 2 years ago. It also requires Spring Framework 5.2. You should upgrade to Spring Boot 2.6.x or 2.7.x as soon as you can.

Sure, thanks