'class not found' issue with ColdFusion event gatewa

Posted by Admin on 05-May-2009 14:57

I am trying to develop and event gateway listener in ColdFusion that subscribes to a SonicMQ ESB server.  I have the functionality working as I would like talking to an ActiveMQ server for development purposes, but now that I am trying to change it over to point to a SonicMQ server I am having issues where starting the gateway fails with an error: Failed to start gateway: Cannot instantiate class: progress.message.jclient.QueueConnectionFactory.

It is probably obvious enought, but I am using an initialContextFactory of progress.message.jclient.QueueConnectionFactory.

I have added all sonic*.jar files from the SonicMQ installation to the Java classpath, including sonic_Client.jar, which I am under the impression should contain this class.  Can anyone think of any dependency that I may be missing that could create the error I am seeing?

Thanks in advance.

~Dave

All Replies

Posted by Bill Wood on 17-Nov-2009 14:46

dshuck wrote:

...

It is probably obvious enought, but I am using an initialContextFactory of progress.message.jclient.QueueConnectionFactory

...

~Dave

I think your problem is that the javax.naming.InitialContextFactory should be the com.sonicsw.jndi.mfcontext.MFContextFactory.   When you get a connection object, then the object bound in the naming service would be a progress.message.jclient.QueueConnectionFactory.

The example (in /MQ7.6/samples/QueuePTP/JNDITalk.java) might help you with this.   The InitialContext is created from com.sonicsw.jndi.mfcontext.MFContextFactory.   A ConnectionFactory is retrieved from this, and the Connection built from that.

    /** Create JMS client for sending and receiving messages. */
    private void talker( String broker, String username, String password, String rQueue, String sQueue)
    {
        Context context = null;
        Hashtable env = new Hashtable();

        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sonicsw.jndi.mfcontext.MFContextFactory");
        env.put("com.sonicsw.jndi.mfcontext.domain", "Domain1");
        env.put(Context.PROVIDER_URL, broker);
        env.put(Context.SECURITY_PRINCIPAL, username);
        env.put(Context.SECURITY_CREDENTIALS, password);

        try
        {
            // Create InitialContext for lookup.
            context = new javax.naming.InitialContext(env);

            javax.jms.ConnectionFactory factory = null;
            try
            {
                // Retrive the ConnectionFactory object.
               factory = (javax.jms.ConnectionFactory)context.lookup(CF_LOOKUP_NAME);
            }
            catch(NameNotFoundException e) { }

This thread is closed