Caused by: java.lang.reflect.MalformedParameterizedTypeException

在ssm项目中集成dubbo的过程中,启动项目报错

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in URL [jar:file:/D:/tools/ideaworkspace/spring/applicationContext-dao.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:308)
Caused by: java.lang.reflect.MalformedParameterizedTypeException
	at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(Unknown Source)
	at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.(Unknown Source)
	at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(Unknown Source)
	at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(Unknown Source)
	at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Unknown Source)
	at sun.reflect.generics.tree.ClassTypeSignature.accept(Unknown Source)
	at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(Unknown Source)
	at java.lang.Class.getGenericInterfaces(Unknown Source)
	at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:154)
	at org.springframework.core.GenericTypeResolver.resolveParameterType(GenericTypeResolver.java:83)
	at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getWriteMethodParameter(GenericTypeAwarePropertyDescriptor.java:109)
	at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:91)
	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
	... 58 more

分析:使用的dubbo的maven依赖是

        
            com.alibaba
            dubbo
            2.5.3
        

我用的spring的版本是4.x,与spring的版本jar冲突,需要修改pom.xml,修改成如下

        
            com.alibaba
            dubbo
            2.5.3
            
                
                    spring
                    org.springframework
                
            
        

重启项目 问题解决。

如果还没解决,那么就去看一下是否有别的jar包冲突

你可能感兴趣的:(异常解决)