Search code examples
javaibm-mqaxisjax-rpc

Apache Axis JAX-RPC over IBM MQ - IllegalArgumentException: noCFName


I'm trying to create a JAX-RPC client with JMS / IBM MQ transport.

I'm using the following guide as reference: https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.5.0/com.ibm.mq.dev.doc/q033020_.htm

I have received the wsdl from an external party. It contains only http bindings, but we are required to use JMS/IBM MQ transport. The endpoint is .NET and IBM MQ 8.

I use Axis 1.4 to generate classes from wsdl. When I try to test the web service call with the endpoint URL provided by external party:

public static void main(String[] args) throws MalformedURLException, ServiceException, RemoteException {
    com.ibm.mq.soap.Register.extension();
    Wf1AGwImplLocator locator = new Wf1AGwImplLocator();
    IWf1AGw impl = locator.getBasicHttpBinding_IWf1aGw(
            new URL("jms:/queue?destination=QG.WF1AGW.REQ&amp;connectionFactory=clientChannel(WIP.SVRCONN)clientConnection(<externalIP1>(1414), <externalIP2>(1414))&amp;initialContextFactory=com.ibm.mq.jms.Nojndi&amp;replyDestination=QP.ABBSVC.WF1AGW.RESP&amp;timeToLive=30000&amp;persistence=1"));

    impl.dispatch("", "", "", "", "",false, "", "", 1, Calendar.getInstance(), false, "", "");
}

I get the following error:

cannotConnect; nested exception is: 
    java.lang.IllegalArgumentException: noCFName
    at org.apache.axis.transport.jms.JMSConnectorManager.getConnector(JMSConnectorManager.java:122)
    at org.apache.axis.transport.jms.JMSTransport.setupMessageContextImpl(JMSTransport.java:163)
    at org.apache.axis.client.Transport.setupMessageContext(Transport.java:46)
    at org.apache.axis.client.Call.invoke(Call.java:2738)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at com.test.BasicHttpBinding_IWf1AGwStub.dispatch(BasicHttpBinding_IWf1AGwStub.java:201)
    at com.test.Test.main(Test.java:19)
Caused by: java.lang.IllegalArgumentException: noCFName
    at org.apache.axis.components.jms.JNDIVendorAdapter.getConnectionFactory(JNDIVendorAdapter.java:71)
    at org.apache.axis.components.jms.JNDIVendorAdapter.getQueueConnectionFactory(JNDIVendorAdapter.java:55)
    at org.apache.axis.transport.jms.JMSConnectorFactory.createConnector(JMSConnectorFactory.java:227)
    at org.apache.axis.transport.jms.JMSConnectorFactory.createClientConnector(JMSConnectorFactory.java:178)
    at org.apache.axis.transport.jms.JMSConnectorManager.getConnector(JMSConnectorManager.java:107)

The error text suggests that I need to name the QCF even though this is a nojndi QCF? How can I solve this?


Solution

  • Needed to add a client-config.wsdd to my project and add the following line:

    <transport name="jms" pivot="java:com.ibm.mq.soap.transport.jms.WMQSender"/>
    

    To override the client-config in axis.jar. I thought this was already done in this call:

    com.ibm.mq.soap.Register.extension();
    

    It still complained about the connection factory. Apparently it didn't understand the URL and I had to replace all &amp; with & and remove the ports(it defaults to 1414 anyway..)

    EDIT: The IllegalArgumentException: noCFName occurs because of the ORDER of the external libraries. The jars in MQ_INSTALLATION_PATH/java/lib must be compiled before the jars in MQ_INSTALLATION_PATH/java/lib/soap.