Search code examples
weblogic12cspring-jmstibco-ems

deploying to other Server gives ClassNotFoundException TIBCO JMS


I was able to deploy my app successfully in dev. I am using Spring JMS template to communicate with Tibco Client and in weblogic i have setup a foreign server with destination queue as Tibco queue and connection factory with Tibco connection factory. My JNDI Initial Context Factory: is tcp://name:port...I was able to publish the message and listen to it. No issues.

ISSUE: When deploying to QA (the war from dev is taken and placed into QA) and during the deployment process we get this

Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: com.tibco.tibjms.naming.TibjmsInitialContextFactory [Root exception is javax.naming.NoInitialContextException: Cannot instantiate class: com.tibco.tibjms.naming.TibjmsInitialContextFactory [Root exception is java.lang.ClassNotFoundException: com.tibco.tibjms.naming.TibjmsInitialContextFactory]]
    at weblogic.utils.StackTraceDisabled.unknownMethod()
Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: com.tibco.tibjms.naming.TibjmsInitialContextFactory [Root exception is java.lang.ClassNotFoundException: com.tibco.tibjms.naming.TibjmsInitialContextFactory]
    ... 1 more
Caused by: java.lang.ClassNotFoundException: com.tibco.tibjms.naming.TibjmsInitialContextFactory
    ... 1 more

Any suggestions on what might be going wrong?

EDIT: People have suggested that this is a clear class path error. But in dev i did not include anything in class path on start server in weblogic.


Solution

  • Instead of adding a foreign server to weblogic, I went with JMS template and set the below properties.

    @Bean
        public JndiTemplate jndiTemplate() throws JMSException {
            JndiTemplate jndiTemplate = new JndiTemplate();
            Properties jndiProps = new Properties();
            Properties props = System.getProperties();
            String env = props.getProperty("cwt.env");
            jndiProps.setProperty("java.naming.factory.initial", environment.getProperty("ems.contextFactory"));
            jndiProps.setProperty("java.naming.security.principal", environment.getProperty("java.naming.security.principal"));
            jndiProps.setProperty("java.naming.security.credentials", environment.getProperty("java.naming.security.credentials"));
            jndiProps.setProperty("java.naming.provider.url", environment.getProperty("tibco.ems.namingUrl"));
    
            jndiTemplate.setEnvironment(jndiProps);
            return jndiTemplate;
        }
    

    in .properties file place this

    ems.contextFactory=com.tibco.tibjms.naming.TibjmsInitialContextFactory
    

    Also, add tibjms dependency in pom.