I'm trying to migrate my project from Java 11 to Java 17 while also updating to Spring Boot 3.
The depencies I use for this solace-jms-spring-boot starter and autoconfigure, both on v 4.3.0. My problem is that the DefaultJmsListenerContainerFactory requires a ConnectionFactory that extends Jakarta ConnectionFactory, but the SolConnectionFactory is javax. I get the SolConnectionFactory from the dependency "com.solacesystems:sol-jms:10.18.0" which seems to be the latest but still uses javax.
@Configuration
@EnableJms
public class JmsConfiguration {
@Bean
public DefaultJmsListenerContainerFactory jmsConnectionFactory(
@Value("${spring.jms.listener.auto-startup:true}")
boolean autoStart,
SolConnectionFactory connectionFactory) {
connectionFactory.setClientID(CLIENT_ID);
var factory = new DefaultJmsListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);//<-- Problem is here
factory.setAutoStartup(autoStart);
factory.setConcurrency(CONCURRENCY_LIMIT);
return factory;
Is there a new version for SolConnectionFactory that uses jakarta or any workaround to get this working?
Any progress since your last comment?
Is there any concrete plan for a permanent solution for SolConnectionFactory that uses jakarta?
ok, i already saw this is available via https://github.com/SolaceProducts/solace-spring-boot
thanks :smile:
Hi Team,
i am new to solace system, as part of project requirement i want to migrate from javax.jms.ConnectionFactory to jakarta.jms.ConnectionFactory it means Springboot 2 to Springboot3. while searching in community forums found this url suits to me.
could anyone please help me how to run the above git project to test locally.
Here i require two things help.
while running application getting below error
Parameter 0 of method cFactory in com.example.demo.ConsumerConfiguration required a bean of type 'jakarta.jms.ConnectionFactory' that could not be found.
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
@Service
static class MessageProducer implements CommandLineRunner {
private static final Logger logger = LoggerFactory.getLogger(MessageProducer.class);
@Autowired
private JmsTemplate jmsTemplate;
// Examples of other options to get JmsTemplate in a cloud environment with possibly multiple providers available:
// Use this to access JmsTemplate of the first service found or look up a specific one by
// SolaceServiceCredentials
// @Autowired private SpringSolJmsConnectionFactoryCloudFactory springSolJmsConnectionFactoryCloudFactory;
// @Autowired private SolaceServiceCredentials solaceServiceCredentials;
// For backwards compatibility:
// @Autowired(required=false) private SolaceMessagingInfo solaceMessagingInfo;
@EnableJms
@Configuration
public class ConsumerConfiguration {
private static final Logger logger = LoggerFactory.getLogger(ConsumerConfiguration.class);
// Example configuration of the ConnectionFactory: we instantiate it here ourselves and set an error handler
@Bean
public DefaultJmsListenerContainerFactory cFactory(ConnectionFactory connectionFactory, DemoErrorHandler errorHandler) {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
factory.setErrorHandler(errorHandler);
return factory;
@Service
public class DemoErrorHandler implements ErrorHandler{
public void handleError(Throwable t) {
ByteArrayOutputStream os = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(os);
t.printStackTrace(ps);
try {
String output = os.toString("UTF8");
logger.error("============= Error processing message: " + t.getMessage()+"\n"+output);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
2. Using this below properties in application.properties but i could not able to test publisher and consumer messages.