question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to wire TopicConnectionFactory Beans, since they get wrapped by LazyConnectionFactory

See original GitHub issue

Dear Spring Cloud Team,

Since Version 2.1.0 the class TracingConnectionFactoryBeanPostProcessor wraps any javax.jms.ConnectionFactory into a LazyConnectionFactory.

This creates an issue when autowiring beans of type javax.jms.TopicConnectionFactory, since any TopicConnectionFactory gets wrapped in a LazyConnectionFactory (Check LazyConnectionFactory:78).

But since the LazyConnectionFactory is not assignable to TopicConnectionFactory the following exception is thrown during the wiring process:

Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'activeMqConnectionFactory' is expected to be of type 'javax.jms.TopicConnectionFactory' but was actually of type 'org.springframework.cloud.sleuth.instrument.messaging.LazyConnectionFactory'
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1257)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1167)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760)
	... 51 common frames omitted```

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:20 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
marcingrzejszczakcommented, Apr 8, 2019

Problem is solved in the latest snapshot build.

0reactions
shadabbahadaracommented, Jan 21, 2022

Correct, that’s the expected behavior @marcingrzejszczak If we need to use org.apache.activemq.pool.PooledConnectionFactory with sleuth, is ther any way to use it instead of LazyTopicConnectionFactory?

Read more comments on GitHub >

github_iconTop Results From Across the Web

BeanNotOfRequiredTypeExcepti...
The LazyConnectionFactory simply wraps your connection factory (in it's delagate property), but it doesn't provide access to the delegate. If ...
Read more >
spring-cloud/spring-cloud-sleuth - Gitter
Does the ConnectionFactory get created as a bean? ... Yeah, though I think there must be one since I don't believe the wrapping...
Read more >
Unable to connect TopicConnectionFactory to host,Client ID ...
Hi, I am facing an issue with my java application which is trying to connect with the server via jms. The application tries...
Read more >
javax.jms.XAConnectionFactory Java Examples
Tests if preparing a DTX branch after setting fail flag in dtx.end throws an ... Wrap the caching connection factories instead of its...
Read more >
IT25917: A MQ-Java/JMS application fails to connect to ... - IBM
APAR status. Closed as program error. Error description. An IBM MQ classes for JMS application is attempting to connect to a queue manager...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found