2

I am trying to work on a tibco JMS CDC product. I have issues setting up the configuration and could not find a solution to my problem.

import com.tibco.tibjms.TibjmsConnectionFactory;

import javax.jms.JMSException;
@Configuration
@EnableJms
public class TibcoBusConfiguration {
    @Value("${ems.password}")
    private String password;

    @Value("${ems.port}")
    private String port;

    @Value("${ems.topic}")
    private String queue;

    @Value("${ems.server}")
    private String server;

    @Value("${ems.user}")
    private String user;

    @Bean(name = "tibjmsConnectionFactory")
    public TibjmsConnectionFactory jmsConnectionFactory() throws javax.jms.JMSException {
        final TibjmsConnectionFactory factory = new TibjmsConnectionFactory();

        factory.setServerUrl(serverURL());
        factory.setUserName(user);
        factory.setUserPassword(password);

        return factory;
    }

    @Bean
    public JmsTemplate jmsTemplate(
        @Autowired TibjmsConnectionFactory tibjmsConnectionFactory) throws JMSException {
        final JmsTemplate jmsTemplate = new JmsTemplate();

        jmsTemplate.setConnectionFactory(jmsConnectionFactory());
        jmsTemplate.setDefaultDestinationName(queue);
        jmsTemplate.setExplicitQosEnabled(true);
        jmsTemplate.setDeliveryMode(DeliveryMode.PERSISTENT);
        jmsTemplate.setSessionAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
        jmsTemplate.setSessionTransacted(false);

        return jmsTemplate;
    }

    private String serverURL() {
        return "tcp://" + server + ":" + port;
    }



}

Unfortunately JmsTemplate only allows jakarta.jms.ConnectionFactory, how do I pass in the TibcoConnectionFactory, because casting is not allowed since the classes do not match. Is my understanding of this incorrect?

I have the following JAR's in my maven setup: tibjms.jar jakarta.jms-api-3.0 javax.jms-api-2.0

Thanks in Advance

  • This is tough because the Tibco docs don't show the entire inheritance hierarchy. If `TibjmsConnectionFactory` doesn't implement `javax.jms.ConnectionFactory` they you may be out of luck. – Jim Garrison Jan 24 '23 at 20:13
  • 1
    Boot 3/Spring 6 moved from the javax to the jakarta namespace for JEE support - you either need to find a Tibco jar for JEE 9 or drop back to Boot 2.7/Spring 5.3. – Gary Russell Jan 24 '23 at 20:14

3 Answers3

3

Boot 3/Spring 6 moved from the javax to the jakarta namespace for JEE support - you either need to find a Tibco jar for JEE 9 or drop back to Boot 2.7/Spring 5.3.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
2

Encountered same issue. tibjms has jakarta compatible library that comes with Tibco EMS 10.2. Unfortunately, this library is not published in public maven repo. To be able to use this, download the latest Tibco EMS community edition, install in the system and you will be able to see the lib under tibco/ems/10.2/lib folder with name jakarta.jms-tibjms.jar Upload it to your private nexus repo and thats it. You need corresponding jakarta.jms-api dependency. This library is available in public maven repo.

starball
  • 20,030
  • 7
  • 43
  • 238
VinayBS
  • 389
  • 5
  • 19
0

Spring Boot 3 moved to the jakarta namespace. To be compatible with it, you need to use the (jakarta) client libraries from TIBCO EMS 10, those are backwards compatible.

pascalre
  • 305
  • 1
  • 4
  • 20