How to use MQ management API in a custom ESB service?

Posted by teeljb on 13-Nov-2011 18:51

I'm running Sonic 7.6, with several custom ESB services.  I'm trying to use the MQ management API within a service, in order to look up the URL for a Direct SOAP route.  I've added the import packages to the service source code (copied from the Sonic sample code), and I've also added the sonic_mgmt_client.jar, mgmt_client.jar, and mgmt_config.jar files to the project's Java Build Path.  The project builds successfully within Workbench.  Yet the process which uses this code fails to start, receiving a "NoClassDefFoundError" for com/sonicsw/mq/mgmtapi/config/IRouteSonicBean - which I've verified is contained within sonic_mgmt_client.jar.

Do I have to add the C:\Sonic\MQ7.6\lib directory somewhere?  I assumed that both .\MQ7.6\lib and .\ESB7.6\lib were already available to my custom services, but it appears that I am wrong about that.

Message was edited by: Jim Teel

All Replies

Posted by pmeadows on 14-Nov-2011 04:20

The ESB container picks up the core Sonic classes it needs from pre-packaged .car (container archive) files, i.e. MFcontainer.car and ESBcontainer.car, not from MQ7.6\lib and ESB7.6\lib. These .car files contain a selection of the jars found in the lib directories but sonic_mgmt_client.jar isn't among them. Presumably you'll need to add sonic_mgmt_client.jar to the appropriate classpath - I guess your service's classpath but I've not tried this.

Out of interest, what's the reason for looking up the URL for a Direct SOAP route? Is this something you do once when the service is initialized, or are you intending to make Sonic management calls every time the service processes a message? (I'd try to avoid the latter)

Are you aware that you can use a vanilla HTTP URL as a JMS destination, e.g. "http://someservice.com/service" - it's not necessary to include the HTTP Routing Node name?  The broker will then do a reverse lookup using the URL to find and use the most appropriate HTTP Routing Definition.

This thread is closed