天天看点

java.lang.reflect.MalformedParameterizedTypeException 的解决办法

近期在开发项目时用到了spring mvc 和mybatis时运行出现如下错误:

org.springframework.beans.factory.beancreationexception: error creating bean with name 'sqlsessionfactory' defined in class path resource [config/spring-database.xml]: initialization of bean failed; nested exception is java.lang.reflect.malformedparameterizedtypeexception

网上搜了一圈都说是springmvc和mybatis的版本冲突,改过之后,还是一样。

今天突然想到了调试一下他们的源码

新到断点到  malformedparameterizedtypeexception 中

运行后发现具体的错误是 org.apache,ibatis的问题,查了一下,ibatis早改为mybatis了,然后去掉这个引用就正常了。

其它解决问题的办法在于找到真正的 问题所在。光看表面的提示其是查不出问题的