Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Cannot instantiate class: com.ibm.mq.jms.context.WMQInitialContextFactory

sidhu
sidhu Posts: 36

We are trying to use JNDI connections in queue browser by specifying connectionFactory= com.sun.jndi.fscontext.RefFSContextFactory in parasoft Virtualise queue browser but I am getting error as below for
I am using com.ibm.mq.allclient-9.1.5.0.jar as well as fscontext-4.2.jar

Cannot instantiate class: com.ibm.mq.jms.context.WMQInitialContextFactory
Could not create JMS InitialContext instance: com.ibm.mq.jms.context.WMQInitialContextFactory
Cannot instantiate class: com.ibm.mq.jms.context.WMQInitialContextFactory

Can someone help in what is wrong here

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
    edited April 2020

    Did you add IBM MQ client jar(s)?
    In recent versions of IBM MQ it is an "com.ibm.mq.allclient.jar".
    The JNDI file system provider (RefFSContextFactory) needs to be able to load classes referenced in your .bindings file which in this case are classes from the IBM MQ java client.
    See IBM MQ client jar info and Adding Required jar Files.

  • sidhu
    sidhu Posts: 36

    hi how do i know whichcom.ibm.mq.allclient.jar to download since in Parasoft virtualise i can see ibm webshpehere mq do i need to install ibm mq version 9 jar , also it mentioneds activemq-.jar and spring-1.x.jar from where do i download all the required jars? i got .ibm.mq.allclient-9.1.5.0.jar isnt this right one?

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Hi,

    Which jar you needed is going to be base on what version of WebSphere MQ your application is using. I would contact who ever owns your WebSphere MQ server to find out what client jar you need or someone who works on the application that will be connecting to the virtual service since they would also potentially know what version the WebSphere MQ server.

    Those other two jars are unrelated to WebSphere MQ so you should not need them.

  • sidhu
    sidhu Posts: 36

    Hi william i downloaded parasoft virtualise 9.10.8 version in which i found ibm mq was present for virtualise server in transport is it possible to track which version of MQ i am using through parasoft team

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Hi,

    The version of WebSphere MQ client jar is going to be based on the WebSphere MQ server in your infrastructure that you are connecting to.

  • ashwini
    ashwini Posts: 11

    Hi,
    At server side we are using Websphere MQ version 7. I have downloaded all below jars and added in System Properties but still I am getting below error in my Event Monitor.
    Error Message:
    Could not create JMS InitialContext instance: com.ibm.mq.jms.context.WMQInitialContextFactory

    Jars

    com.ibm.mq.jar
    com.ibm.mqjms.jar
    com.ibm.mq.commonservices.jar
    com.ibm.mq.headers.jar
    com.ibm.mq.jmqi.jar
    connector.jar
    dhbcore.jar
    com.ibm.mq.pcf.jar

    I am not able to find mqcontext.jar (I think this is required for Initial Context Factory). Can someone tell me the location of this jar in product package so that I can

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Hi,

    That jar comes from IBM. You would have to check their documentations, etc. to find where to get the proper jar files.

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
    edited May 2020

    RefFSContextFactory and WMQInitialContextFactory are two different InitialContextFactory implementations. Typically you use one or the other. IBM doesn't provide the jar for WMQInitialContextFactory (mqcontext.jar) anymore so it can be difficult to acquire. So, I typically see RefFSContextFactory (fscontext.jar) being used instead. If you are using RefFSContextFactory and using a JNDI provider URL pointing to a folder containing a .bindings file, then I'm not sure offhand why you would see message about something trying to load WMQInitialContextFactory.

    IBM docs for creating .bindings file that can be used for RefFSContextFactory which shouldn't require WMQInitialContextFactory:
    https://www.ibm.com/support/knowledgecenter/SS6PEW_10.0.0/integration/t_CreatingJMSBindingsInIBMWebSphereMQ.html

  • ashwini
    ashwini Posts: 11

    Hi Benken,

    I tried with com.ibm.mq.jms.context.RefFSContextFactory with fscontext.jar in system properties but still I am getting below error.

    Error Message:
    Could not create JMS InitialContext instance: com.ibm.mq.jms.context.RefFSContextFactory

    Additional Details:
    Cannot instantiate class: com.ibm.mq.jms.context.RefFSContextFactory

    I walk-through the bindings file article which you have shared. At server side already there is QueueManager created as part of MQ setup but as a client I don't have any JMSAdmin.config at my local machine from where I am executing SOATest.

    So I am not sure that how point 3-5 are applicable from a client perspective. DO I need some additional setup on my local for MQ ?

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
    edited May 2020

    "com.ibm.mq.jms.context.RefFSContextFactory" is the wrong class name.
    Didn't you mention using "com.sun.jndi.fscontext.RefFSContextFactory"?
    Didn't you already create a .binding file with JMSAdmin tool?