简体   繁体   中英

Hibernate and Spring Boot MalformedParameterizedTypeException: null while initializing bean (org.apache.commons.dbcp2.BasicDataSource)

I have Spring 1.5.21.RELEASE spring boot project and I am not able to initialize the Spring Boot Datasoruce org.apache.commons.dbcp2.BasicDataSource. When application start-up I get the following exception. I have tried and try to debug but I am not able to figure which incompatibility causing this issue. I am using Java 8.

 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Dbcp2.class]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
        ... 211 common frames omitted
    Caused by: java.lang.reflect.MalformedParameterizedTypeException: null
        at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:58)
        at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:51)
        at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:92)
        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.getParameterTypes(ConstructorRepository.java:94)
        at java.lang.reflect.Executable.getGenericParameterTypes(Executable.java:283)
        at java.lang.reflect.Method.getGenericParameterTypes(Method.java:283)
        at java.lang.reflect.Executable.getAllGenericParameterTypes(Executable.java:302)
        at java.lang.reflect.Executable.getAnnotatedParameterTypes(Executable.java:693)
        at java.lang.reflect.Parameter.getAnnotatedType(Parameter.java:237)
        at org.hibernate.validator.internal.metadata.provider.TypeAnnotationAwareMetaDataProvider.findTypeAnnotationConstraintsForExecutableParameter(TypeAnnotationAwareMetaDataProvider.java:85)
        at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getParameterMetaData(AnnotationMetaDataProvider.java:498)
        at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.findExecutableMetaData(AnnotationMetaDataProvider.java:347)
        at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getMetaData(AnnotationMetaDataProvider.java:332)
        at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getMethodMetaData(AnnotationMetaDataProvider.java:318)
        at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.retrieveBeanConfiguration(AnnotationMetaDataProvider.java:138)
        at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getBeanConfiguration(AnnotationMetaDataProvider.java:125)
        at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getBeanConfigurationForHierarchy(AnnotationMetaDataProvider.java:108)
        at org.hibernate.validator.internal.metadata.BeanMetaDataManager.createBeanMetaData(BeanMetaDataManager.java:203)
        at org.hibernate.validator.internal.metadata.BeanMetaDataManager.getOrCreateBeanMetaData(BeanMetaDataManager.java:231)
        at org.hibernate.validator.internal.metadata.BeanMetaDataManager.getBeanMetaData(BeanMetaDataManager.java:178)
        at org.hibernate.validator.internal.engine.ValidatorImpl.getConstraintsForClass(ValidatorImpl.java:327)
        at org.springframework.validation.beanvalidation.SpringValidatorAdapter.getConstraintsForClass(SpringValidatorAdapter.java:304)
        at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor$ValidatedLocalValidatorFactoryBean.supports(ConfigurationPropertiesBindingPostProcessor.java:429)
        at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.determineValidator(ConfigurationPropertiesBindingPostProcessor.java:355)
        at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:316)
        at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:297)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:407)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1622)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)

Here is spring lib list :

camel-spring-2.17.7.jar
camel-spring-boot-2.17.7.jar
camel-spring-boot-starter-2.17.7.jar
camel-spring-redis-2.17.7.jar
shiro-spring-1.2.3.jar
spring-aop-4.3.24.RELEASE.jar
spring-aspects-4.3.24.RELEASE.jar
spring-beans-4.3.24.RELEASE.jar
spring-boot-1.5.21.RELEASE.jar
spring-boot-autoconfigure-1.5.21.RELEASE.jar
spring-boot-starter-1.5.21.RELEASE.jar
spring-boot-starter-aop-1.5.21.RELEASE.jar
spring-boot-starter-data-jpa-1.5.21.RELEASE.jar
spring-boot-starter-jdbc-1.5.21.RELEASE.jar
spring-boot-starter-logging-1.5.21.RELEASE.jar
spring-boot-starter-tomcat-1.5.21.RELEASE.jar
spring-boot-starter-web-1.5.21.RELEASE.jar
spring-context-4.3.24.RELEASE.jar
spring-context-support-4.3.24.RELEASE.jar
spring-core-4.3.24.RELEASE.jar
spring-data-commons-1.13.22.RELEASE.jar
spring-data-jpa-1.11.22.RELEASE.jar
spring-data-keyvalue-1.2.22.RELEASE.jar
spring-data-redis-1.8.22.RELEASE.jar
spring-expression-4.3.24.RELEASE.jar
spring-jdbc-4.3.24.RELEASE.jar
spring-orm-4.3.24.RELEASE.jar
spring-oxm-4.3.24.RELEASE.jar
spring-security-config-4.2.12.RELEASE.jar
spring-security-core-4.2.12.RELEASE.jar
spring-security-web-4.2.12.RELEASE.jar
spring-test-4.3.24.RELEASE.jar
spring-tx-4.3.24.RELEASE.jar
spring-web-4.3.24.RELEASE.jar
spring-webmvc-4.3.24.RELEASE.jar

Here is hiberate Lib:

hibernate-commons-annotations-5.0.4.Final.jar
hibernate-core-5.3.10.Final.jar
hibernate-entitymanager-5.3.10.Final.jar
hibernate-types-52-1.0.0.jar
hibernate-validator-5.3.6.Final.jar

I had to use a newer version of commons-pool2 from 2.5.4 to 2.6.2.

<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-pool2 -->
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-pool2</artifactId>
    <version>2.6.2</version>
</dependency>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM