问题描述
1. 使用Spring3 的 org.apache.activemq.pool.PooledConnectionFactory
2. connectionFactory 初始化时, 打印下面关于MalformedParameterizedTypeException的错误信息:
Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
原因:
activemq-pool 的版本号是5.8.0, 它依赖的commons-pool的版本号是1.6;
当前工程的的maven依赖继承关系中另外一个jar包依赖了1.5.6版本的commons-pool。
解决办法
在maven依赖中排除不需要的版本。
<dependency>
<groupId>com.test.demo</groupId>
<artifactId>demo-core</artifactId>
<version>1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</exclusion>
</exclusions>
</dependency>