activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jiri Patera (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AMQ-4189) PooledConnectionFactory with JmsTemplate results in MalformedParameterizedTypeException
Date Wed, 05 Dec 2012 14:46:59 GMT

    [ https://issues.apache.org/jira/browse/AMQ-4189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13510509#comment-13510509
] 

Jiri Patera commented on AMQ-4189:
----------------------------------

I can see that the {{activemq-pool}} artifact depends on the {{commons-pool:1.6}} artifact:

{code}
[INFO] +- org.apache.activemq:activemq-pool:jar:5.7.0:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.6.6:compile
[INFO] |  +- org.apache.activemq:activemq-core:jar:5.7.0:compile
[INFO] |  +- org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec:jar:1.0.1:compile
[INFO] |  \- commons-pool:commons-pool:jar:1.6:compile
{code}

What happened in our case was that in the project we had the {{commons-pool:1.5.4}} artifact
placed closer to the dependency tree root and, thus, it was winning:

{code}
<dependencies>
  <dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-pool</artifactId>
    <version>5.7.0</version>
  </dependency>
  <dependency>
    <groupId>commons-pool</groupId>
    <artifactId>commons-pool</artifactId>
    <version>1.5.4</version>
  </dependency>
</dependencies>
{code}

That produces the following dependency tree ({{mvn dependency:tree -Dverbose -Dincludes=:commons-pool:}}):

{code}
[INFO] com.gk-software.test:test-b:jar:1.0.0-SNAPSHOT
[INFO] +- org.apache.activemq:activemq-pool:jar:5.7.0:compile
[INFO] |  \- (commons-pool:commons-pool:jar:1.6:compile - omitted for conflict with 1.5.4)
[INFO] \- commons-pool:commons-pool:jar:1.5.4:compile
{code}

The problematic method is: 
{{public org.apache.commons.pool.ObjectPoolFactory org.apache.activemq.pool.PooledConnectionFactory.getPoolFactory()}}

Its return type is being inspected by the following method: {{org.springframework.core.GenericTypeResolver.resolveReturnType(Method,
Class)}}

Which in turn calls Java Reflection API: {{method.getGenericReturnType()}}

And this produces the {{java.lang.reflect.MalformedParameterizedTypeException}} exception
in case the {{commons-pool:1.5.4}} is on the classpath instead of the correct {{commons-pool:1.6}}.

So from my point of view this is not an issue of the {{activemq-pool}} artifact, but of a
Maven dependency tree (or classpath) in the user's project.
                
> PooledConnectionFactory with JmsTemplate results in MalformedParameterizedTypeException
> ---------------------------------------------------------------------------------------
>
>                 Key: AMQ-4189
>                 URL: https://issues.apache.org/jira/browse/AMQ-4189
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: activemq-pool
>    Affects Versions: 5.7.0
>         Environment: Tomcat 7.0.27
> Spring 3.1.2
>            Reporter: Pragadeesh Prakasam
>         Attachments: ConnectionPoolTest.java, jms-local-test.xml
>
>
>   <!-- JMS ConnectionFactory to use, configuring the embedded broker using XML -->
>   <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost"/>
>   
>   <!-- Spring JMS Template -->
>   <bean id="myJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
>     <property name="connectionFactory">
>       <!-- lets wrap in a pool to avoid creating a connection per send -->
>       <bean class="org.springframework.jms.connection.SingleConnectionFactory">
>         <property name="targetConnectionFactory">
>           <ref local="jmsFactory" />
>         </property>
>       </bean>
>     </property>
>   </bean>
> here if we use org.apache.activemq.pool.PooledConnectionFactory  instead of org.springframework.jms.connection.SingleConnectionFactory,

> we are receiving org.springframework.beans.factory.BeanCreationException: Initialization
of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException

> We got this when we upgraded from ActiveMQ 5.4 to 5.7

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message