将Spring Boot 2.1升级到2.2时出现MalformedParameterizedTypeException

时间:2020-07-02 13:15:21

标签: java spring spring-boot maven

当我尝试将Spring Boot 2.1升级到Spring boot 2.2时,我有了这个StackTrace

2020-07-02 15:07:37.890  INFO 12116 --- [           main] f.i.e.EbadApplication                    : Starting EbadApplication on DWM1107403 with PID 12116 (C:\Developpement\ws\ebad\target\classes started by DTROUILLET in C:\Developpement\ws\ebad)
2020-07-02 15:07:37.894 DEBUG 12116 --- [           main] f.i.e.EbadApplication                    : Running with Spring Boot v2.3.0.RELEASE, Spring v5.2.6.RELEASE
2020-07-02 15:07:37.894  INFO 12116 --- [           main] f.i.e.EbadApplication                    : The following profiles are active: prod
2020-07-02 15:07:37.894 DEBUG 12116 --- [           main] o.s.b.SpringApplication                  : Loading source class fr.icdc.ebad.EbadApplication
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass$3$1 (file:/C:/Local/Maven2/repository/org/codehaus/groovy/groovy-all/1.7.6/groovy-all-1.7.6.jar) to method java.lang.Object.finalize()
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass$3$1 (file:/C:/Local/Maven2/repository/org/codehaus/groovy/groovy-all/1.7.6/groovy-all-1.7.6.jar) to method java.lang.Object.clone()
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass$3$1 (file:/C:/Local/Maven2/repository/org/codehaus/groovy/groovy-all/1.7.6/groovy-all-1.7.6.jar) to method java.lang.Object.registerNatives()
2020-07-02 15:07:38.123 DEBUG 12116 --- [           main] .c.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: unknown
2020-07-02 15:07:38.138 ERROR 12116 --- [           main] o.s.b.SpringApplication                  : Application run failed

java.lang.reflect.MalformedParameterizedTypeException: null
    at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:59) ~[?:?]
    at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:52) ~[?:?]
    at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:93) ~[?:?]
    at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:105) ~[?:?]
    at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:140) ~[?:?]
    at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) ~[?:?]
    at sun.reflect.generics.repository.ConstructorRepository.computeParameterTypes(ConstructorRepository.java:111) ~[?:?]
    at sun.reflect.generics.repository.ConstructorRepository.getParameterTypes(ConstructorRepository.java:87) ~[?:?]
    at java.lang.reflect.Executable.getGenericParameterTypes(Executable.java:279) ~[?:?]
    at java.lang.reflect.Method.getGenericParameterTypes(Method.java:330) ~[?:?]
    at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:391) ~[?:?]
    at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:118) ~[?:?]
    at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:74) ~[?:?]
    at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:58) ~[?:?]
    at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1047) ~[?:?]
    at java.beans.Introspector.getBeanInfo(Introspector.java:462) ~[?:?]
    at java.beans.Introspector.getBeanInfo(Introspector.java:205) ~[?:?]
    at groovy.lang.MetaClassImpl$15.run(MetaClassImpl.java:2940) ~[groovy-all-1.7.6.jar:1.7.6]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
    at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:2938) ~[groovy-all-1.7.6.jar:1.7.6]
    at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2921) ~[groovy-all-1.7.6.jar:1.7.6]
    at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:166) ~[groovy-all-1.7.6.jar:1.7.6]
    at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:182) ~[groovy-all-1.7.6.jar:1.7.6]
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:210) ~[groovy-all-1.7.6.jar:1.7.6]
    at org.springframework.beans.factory.groovy.GroovyBeanDefinitionReader.<init>(GroovyBeanDefinitionReader.java:150) ~[spring-beans-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.BeanDefinitionLoader.<init>(BeanDefinitionLoader.java:85) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.createBeanDefinitionLoader(SpringApplication.java:738) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.load(SpringApplication.java:681) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:392) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at fr.icdc.ebad.EbadApplication.main(EbadApplication.java:44) [classes/:?]

2020-07-02 15:07:38.152  WARN 12116 --- [           main] o.s.b.SpringApplication                  : Unable to close ApplicationContext

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@341a8659, started on Thu Jan 01 01:00:00 CET 1970
    at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:424) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:81) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.availability.AvailabilityChangeEvent.publish(AvailabilityChangeEvent.java:67) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:167) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:978) ~[spring-context-5.2.6.RELEASE.jar:5.2.6.RELEASE]
    at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:814) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) [spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
    at fr.icdc.ebad.EbadApplication.main(EbadApplication.java:44) [classes/:?]

因此,我升级了所有库,例如spring,spring security oauth2,pf4j。 我不知道如何解决这个问题。

我具有与JDK 8和JDK 11相同的StackTrace

链接到我的要旨pom.xml

2 个答案:

答案 0 :(得分:0)

在您的POM中,我看到两个依赖项与用于其他依赖项的Spring Boot 2版本不匹配:

        <dependency>
            <groupId>org.springframework.security.oauth</groupId>
            <artifactId>spring-security-oauth2</artifactId>
            <version>${spring-security-oauth2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security.oauth.boot</groupId>
            <artifactId>spring-security-oauth2-autoconfigure</artifactId>
            <version>2.3.1.RELEASE</version>
        </dependency>

您的父POM正在使用

    <parent>
        <artifactId>spring-boot-starter-parent</artifactId>
        <groupId>org.springframework.boot</groupId>
        <version>2.3.0.RELEASE</version>
        <relativePath />
    </parent>

所以请对spring-security-oauth2-autoconfigure使用相同的

答案 1 :(得分:0)

我清理了本地Maven存储库文件夹,它可以工作。 是由于org.codehaus.groovy与非法反射访问有关。