Showing posts with label MQ. Show all posts
Showing posts with label MQ. Show all posts

Saturday, November 23, 2013

Websphere MQ: getting my feet wet into it

First install Eclipse
http://archive.eclipse.org/eclipse/downloads/drops/R-3.4.2-200902111700/download.php?dropFile=eclipse-SDK-3.4.2-win32.zip

Download and install it - do the custom installation without MQ Explorer which requires also Websphere Eclipse installation.

One restarted, you find an icon in the bottom right "Webpshere MQ Running".
Right click to open the Alert monitor

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.amqtac.doc/wq10860_.htm


For OSB, you should download com.ibm.mq.jar for 7.0.1 :

http://www-01.ibm.com/support/docview.wss?rs=171&uid=swg24019253&loc=en_US&cs=utf-8&lang=en

A useful tool is http://www.angussoft.co.uk/ queuezee. I could not make it work though :o(


________

HOw to configure OSB for MQ:

http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/mqtransport/

new BS, Transport typed,  protocol MQ

Add URI

"The MQ Connection Resource default/mqConnection specified in URI mq://local-queue?conn=default/mqConnection does not exist"

Why? Because you need to create first a  New MQ Connection Resource

this tool can help:
http://www.niratul.com/

before you install, add this to env variable CLASSPATH  
C:\apps\mq\com.ibm.mq.commonservices.jar;C:\apps\mq\com.ibm.mq.defaultconfig.jar;C:\apps\mq\connector.jar;C:\apps\mq\com.ibm.mq.headers.jar;C:\apps\mq\com.ibm.mq.jar;C:\apps\mq\com.ibm.mq.jmqi.jar;C:\apps\mq\com.ibm.mq.pcf.jar;C:\apps\mq\com.ibm.mq.postcard.jar;C:\apps\mq\com.ibm.mq.tools.ras.jar

(these jars are in C:\Program Files\IBM\WebSphere MQ\java\lib)






Friday, June 17, 2011

Java client for Websphere MQ

PutMessage sends 10 messages to the queue
MQReader reads (and consumes) 1 message at a time (getAllMessages() still fails on the getQueueDepth()... investigating...)



package com.acme.mq;

import com.ibm.mq.*;

import java.io.*;
import static com.acme.mq.MQConstants.*;


public class PutMessage {

    private String qManager = MQ_queueManager;
    private String qName = MQ_queue;
    private String qmessageFile = "c:/pierre/mqfile.txt";


    public static void main(String args[]) throws Exception {
        System.out.println("java.library.path=" + System.getProperty("java.library.path"));
        PutMessage pM = new PutMessage();

        pM.runNow();
    }

    public void runNow() throws Exception {
            System.out.println("Connecting to queue manager: " + qManager);
            MQQueueManager qMgr = MQReader.setup();
            int openOptions = 17;
            System.out.println("Accessing queue: " + qName);
            MQQueue queue = qMgr.accessQueue(qName, openOptions);
            File file = new File(qmessageFile);
            for (int i = 0; i < 10; i++) {
                String qmessage = getContents(file) + " " + i;
                MQMessage msg = new MQMessage();
                msg.writeString(qmessage);
                MQPutMessageOptions pmo = new MQPutMessageOptions();
                System.out.println("Sending message: " + qmessage);
                queue.put(msg, pmo);
            }
            System.out.println("Closing the queue");
            queue.close();
            System.out.println("Disconnecting from the Queue Manager");
            qMgr.disconnect();
            System.out.println("Done!");
    }

    private String getContents(File aFile) {
        StringBuffer contents;
        contents = new StringBuffer();
        BufferedReader input = null;
        try {
            input = new BufferedReader(new FileReader(aFile));
            for (String line = null; (line = input.readLine()) != null;) {
                contents.append(line);
                //contents.append(System.getProperty("line.separator"));
            }
        } catch (FileNotFoundException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        } finally {
            try {
                if (input != null)
                    input.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

        return contents.toString();
    }
}





package com.acme.mq;

import com.ibm.mq.*;

import java.text.*;
import java.io.*;
import java.util.Hashtable;
import static com.acme.mq.MQConstants.*;

public class MQReader {
     
    public static void main(String[] args) throws Exception {
        MQReader mqReader = new MQReader();
        mqReader.getMessage();
    }

   
    public void getAllMessages() throws MQException, IOException {
        MQQueueManager qm = setup();
        int options = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_INQUIRE;
        MQQueue q = qm.accessQueue(MQ_queue, options, null, null, null);
        int depth = q.getCurrentDepth();
        DecimalFormat indexFormat = new DecimalFormat(Integer.toString(depth).replaceAll(".", "0"));
        System.out.println("found messages " + depth);
       
        for (int index = 0; index < depth; index++) {
            MQMessage msg = new MQMessage();
            q.get(msg, new MQGetMessageOptions());
            int msgLength = msg.getMessageLength();
            String text = msg.readStringOfByteLength(msgLength);
            System.out.println("message#" + index + "  text=" + text);
        }
    }


   
    public void getMessage() {
          try
          {
             MQQueueManager qm = setup();
             MQQueue q = qm.accessQueue(MQ_queue, MQC.MQOO_INPUT_AS_Q_DEF);

             MQMessage msg = new MQMessage();

             q.get(msg);

             System.out.println("Message: " + msg.readLine());

             q.close();
             qm.disconnect();
          }
          catch(MQException e)
          {
             System.out.println("MQ Error: cc=" + e.completionCode + ", reason=" + e.reasonCode);
          }
          catch(java.io.IOException e)
          {
             System.out.println("IO Error: " + e);
          }        
    }
   


    public static MQQueueManager setup() throws MQException {
        MQEnvironment.hostname = MQ_hostname;
        MQEnvironment.channel = MQ_channel;
        MQEnvironment.port = MQ_port;
        Hashtable<String, String> props = new Hashtable<String, String>();
        props.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);
        MQEnvironment.properties = props;
        MQQueueManager qm = new MQQueueManager(MQ_queueManager);
        return qm;
    }
       
}





package com.acme.mq;

public class MQConstants {
    public static String MQ_hostname = "bla.acme.com";
    public static String MQ_channel = "A123.TO.QMIA00D";
    public static int    MQ_port = 1435;
    public static String MQ_queueManager = "QMIA00D";
    public static String MQ_queue = "AQ.A123.BLA.NOTIFICATION.EVENT";
     
}





I have added to the classpath ALL the MQ jars I could find in my MQ installation...

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
    <classpathentry kind="lib" path="lib/CL3Export.jar"/>
    <classpathentry kind="lib" path="lib/CL3Nonexport.jar"/>
    <classpathentry kind="lib" path="lib/com.ibm.mq.axis2.jar"/>
    <classpathentry kind="lib" path="lib/com.ibm.mq.commonservices.jar"/>
    <classpathentry kind="lib" path="lib/com.ibm.mq.defaultconfig.jar"/>
    <classpathentry kind="lib" path="lib/com.ibm.mq.headers.jar"/>
    <classpathentry kind="lib" path="lib/com.ibm.mq.jar"/>
    <classpathentry kind="lib" path="lib/com.ibm.mq.jmqi.jar"/>
    <classpathentry kind="lib" path="lib/com.ibm.mq.jms.Nojndi.jar"/>
    <classpathentry kind="lib" path="lib/com.ibm.mq.pcf.jar"/>
    <classpathentry kind="lib" path="lib/com.ibm.mq.postcard.jar"/>
    <classpathentry kind="lib" path="lib/com.ibm.mq.soap.jar"/>
    <classpathentry kind="lib" path="lib/com.ibm.mq.tools.ras.jar"/>
    <classpathentry kind="lib" path="lib/com.ibm.mqjms.jar"/>
    <classpathentry kind="lib" path="lib/connector.jar"/>
    <classpathentry kind="lib" path="lib/dhbcore.jar"/>
    <classpathentry kind="lib" path="lib/fscontext.jar"/>
    <classpathentry kind="lib" path="lib/jms.jar"/>
    <classpathentry kind="lib" path="lib/jndi.jar"/>
    <classpathentry kind="lib" path="lib/jta.jar"/>
    <classpathentry kind="lib" path="lib/ldap.jar"/>
    <classpathentry kind="lib" path="lib/providerutil.jar"/>
    <classpathentry kind="lib" path="lib/rmm.jar"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

Tuesday, June 7, 2011

MQ Transport could not be registered due to : Missing MQ Library

you must copy
com.ibm.mq.jar
to C:\Oracle\Middleware\user_projects\domains\soadev\lib, restart the server and the message should go away.

Only at this point you will be able to create MQ-related components.

If you get this:

07-Jun-2011 09:07:10 o'clock CEST Error Deployer BEA-149205 Failed to initialize the application 'MQ Transport Provider' due to error java.lang.ClassNotFoundException: com.ibm.mq.jmqi.JmqiObject.
java.lang.ClassNotFoundException: com.ibm.mq.jmqi.JmqiObject
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: com.ibm.mq.jmqi.JmqiObject
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Truncated. see log file for complete stacktrace



or this


07-Jun-2011 13:27:50 o'clock CEST Error OSB Kernel BEA-380003 Exception on TransportManagerImpl.sendMessageAsync: Error, java.lang.NoClassDefFoundError: Could not initialize class com.ibm.mq.internal.MQCommonServices
java.lang.NoClassDefFoundError: Could not initialize class com.ibm.mq.internal.MQCommonServices
at com.ibm.mq.MQSESSION.getJmqiEnv(MQSESSION.java:134)



or this

07-Jun-2011 11:28:09 o'clock CEST Error WliSbTransports BEA-381913 Error occured while polling the resource for Endpoint: ProxyService$default$PVMQProxy. Polling will be stopped.
java.lang.NoClassDefFoundError: com/ibm/mq/headers/internal/trace/Names
at com.ibm.mq.internal.MQCommonServices.clinit(MQCommonServices.java:241)
at com.ibm.mq.MQSESSION.getJmqiEnv(MQSESSION.java:134)
at com.ibm.mq.MQQueueManagerFactory.init(MQQueueManagerFactory.java:85
)
at com.ibm.mq.MQQueueManagerFactory.getInstance(MQQueueManagerFactory.ja
va:112)
at com.ibm.mq.MQQueueManager.clinit(MQQueueManager.java:153)
Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: com.ibm.mq.headers.internal.trace.N
ames
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Truncated. see log file for complete stacktrace



or this

07-Jun-2011 10:11:08 o'clock CEST Error WliSbTransports BEA-381913 Error occured while polling the resource for Endpoint: ProxyService$default$PVMQProxy. Polling will be stopped.
java.lang.NoClassDefFoundError: com/ibm/mq/commonservices/CommonServicesException
at com.ibm.mq.internal.MQCommonServices.clinit(MQCommonServices.java:236)
at com.ibm.mq.MQSESSION.getJmqiEnv(MQSESSION.java:134)
at com.ibm.mq.MQQueueManagerFactory.init(MQQueueManagerFactory.java:85)
at com.ibm.mq.MQQueueManagerFactory.getInstance(MQQueueManagerFactory.java:112)
at com.ibm.mq.MQQueueManager.clinit(MQQueueManager.java:153)
Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: com.ibm.mq.commonservices.CommonServicesException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Truncated. see log file for complete stacktrace

07-Jun-2011 10:11:08 o'clock CEST Warning WliSbTransports BEA-381914 Missing MQ library com.ibm.mq.jar; please add the missing library to the classpath
.



copy also

com.ibm.mq.jmqi.jar
com.ibm.mq.headers.jar
com.ibm.mq.commonservices.jar
com.ibm.mq.jar (already mentioned above)



to yourdomain/lib and restart.


You should see in the logs:

Following extensions directory contents added to the end of the classpath:
C:\Oracle\Middleware\user_projects\domains\soadev\lib\com.ibm.mq.jar;C:\Oracle
\Middleware\user_projects\domains\soadev\lib\com.ibm.mq.jmqi.jar blablabla


Monday, June 6, 2011

MQ basic commands

to create a Queue Manager:
crtmqm

to start a Queue Manager:
strmqm

to run MQSC:
runmqsc.exe
(wait for a while and hit "enter" to make sure it's ready)

to create local queue:
DEFINE QLOCAL('mylocalqueue')


some definitions (from Wikipedia ) :

Local queues represent the location in which data is stored awaiting processing.

Remote queues represent a queue on another queue manager


see here for full list

Tuesday, March 22, 2011

JBoss and WebSphere MQ

Let's see if this is easier than with WebLogic

http://www.ibm.com/developerworks/websphere/library/techarticles/0710_ritchie/0710_ritchie.html


- you need the file wmq.jmsra.rar, which is in C:\Program Files\IBM\WebSphere MQ\java\lib\jca
(of course you mush install WebSphere MQ to get it :o) )


- copy wmq.jmsra.rar to /server/default/deploy


- create wmq.jmsra-ds.xml in C:\Post\app-rep\itl-v000100-ld-node1\deploy
copy it from here create the wmq.jmsra-ds.xml in

- and copy also wmq.jmsra.ivt.ear to the same folder.

- open http://localhost:8080/WMQ_IVT/


(still having trouble making it work....in the meantime I am posting this)

Tuesday, September 14, 2010

Monitoring MQ queue running on Linux

MQ user interface is VERY mainframe... you must get used to a very stern and dry presentation.

log into your unix box running the mqserver


cd $MQSERVER_HOME/bin

runmqsc myqueuemanager

help

display qstatus(myqueue)



4 : DISPLAY QSTATUS(myqueue)

AMQ8450: Display queue status details.

QUEUE(myqueue) TYPE(QUEUE)

CURDEPTH(0) IPPROCS(2)

LGETDATE( ) LGETTIME( )

LPUTDATE( ) LPUTTIME( )

MEDIALOG( ) MONQ(OFF)

MSGAGE( ) OPPROCS(0)

QTIME( , ) UNCOM(NO)





AMQ8426: Valid MQSC commands are:


ALTER

CLEAR

DEFINE

DELETE

DISPLAY

END

PING

REFRESH

RESET

RESOLVE

RESUME

START

STOP

SUSPEND




Terminology:

Message Queue Interface (MQI)
Queue Manager (QM), which hosts Queues and Channels

Queues can be:
Local queue (held in the QM)
Transmission queue (basically a Bridge)
Remote queue definition (basically a Foreign Queue)
Alias queue (just a nickname for an existing queue)
Model queue (a template)
Cluster queue (like a Uniform Distributed Queue)
Shared queue (???)
Group definition queue (???)

Sunday, August 22, 2010

WebLogic 11g and MQ 7.... when the game gets tough...

(see also a previous post...http://www.javamonamour.org/2010/08/weblogic-integration-with-mq-series.html)


I am following the instructions

http://ibswings.blogspot.com/2008/02/integrating-mq-broker-6-with-bea.html


and I get


Aug 22, 2010 2:26:30 PM CEST Debug EjbDeployment BEA-000000 [EJBModule] activate() on module : EJBModule(MQReceiver) : activating module
Aug 22, 2010 2:26:30 PM CEST Debug EjbDeployment BEA-000000 [MessageDrivenBeanInfoImpl] Calling JMS MDB helper with providerURL=null
Aug 22, 2010 2:26:30 PM CEST Debug JMSCDS BEA-000000 getSubject: before looking up jms/WLReceiverQueue providerIRL = null isLocal = true
Aug 22, 2010 2:26:30 PM CEST Debug JMSCDS BEA-000000 Successfully created the initial context for the JNDIName jms/WLReceiverQueue
Aug 22, 2010 2:26:33 PM CEST Warning EJB BEA-010061 The Message-Driven EJB: TestMDB is unable to connect to the JMS destination: jms/WLReceiverQueue. The Error was:



 javax.jms.JMSException: JMSCS0006: An internal problem occurred. Diagnostic information for service was written to '/Oracle/Middleware/user_projects/domains/OSBDomainBasic/FFDC/JMSCC0004.FDC'. Please terminate the application as the product is in an inconsistent internal state.
        at com.ibm.msg.client.commonservices.trace.Trace.ffst(Trace.java:1386)
        at com.ibm.msg.client.jms.admin.JmsDestinationImpl.readObject(JmsDestinationImpl.java:638)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
        at weblogic.rmi.extensions.server.CBVInputStream.readObject(CBVInputStream.java:64)
        at weblogic.jndi.internal.JNDIHelper.copyObject(JNDIHelper.java:28)
        at weblogic.jndi.WLSJNDIEnvironmentImpl.copyObject(WLSJNDIEnvironmentImpl.java:77)
        at weblogic.jndi.internal.WLEventContextImpl.copyObject(WLEventContextImpl.java:383)
        at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:255)
        at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:393)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at weblogic.jms.common.CDS$2.run(CDS.java:503)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
        at weblogic.jms.common.CrossDomainSecurityManager.runAs(CrossDomainSecurityManager.java:130)
        at weblogic.jms.common.CDS.lookupDestination(CDS.java:497)
        at weblogic.jms.common.CDS.getDDMembershipInformation(CDS.java:276)
        at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.createMDManagers(MessageDrivenBeanInfoImpl.java:1455)
        at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.activate(MessageDrivenBeanInfoImpl.java:1252)
        at weblogic.ejb.container.deployer.EJBDeployer.activate(EJBDeployer.java:1320)
        at weblogic.ejb.container.deployer.EJBModule.activate(EJBModule.java:493)
        at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:227)
        at weblogic.application.internal.flow.DeploymentCallbackFlow$2.next(DeploymentCallbackFlow.java:531)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
        at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:165)
        at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:157)
        at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
        at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
        at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
        at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)



I also get
Exception in thread "Thread-39" java.lang.NoClassDefFoundError: com/ibm/mq/internal/MQCommonServices
 at com.ibm.mq.MQSESSION.getJmqiEnv(MQSESSION.java:134)
 at com.ibm.mq.MQQueueManagerFactory.(MQQueueManagerFactory.java:85)
 at com.ibm.mq.MQQueueManagerFactory.getInstance(MQQueueManagerFactory.java:112)
 at com.ibm.mq.MQQueueManager.(MQQueueManager.java:147)
 at com.bea.wli.sb.transports.mq.MQResiduePurgeThread.run(MQResiduePurgeThread.java:83)


which seems to be addressed here:
http://www.ibm.com/developerworks/forums/thread.jspa?threadID=236529
In this post it mentions some extra JARs for JNDI support, like mqcontext.jar....let's keep an eye on this.... this http://www-01.ibm.com/support/docview.wss?uid=swg24004684 is the support pack...


I target WLEventContextImpl and I find this:

===============================================
Found: WLEventContextImpl
Class: weblogic.jndi.internal.WLEventContextImpl
Package: weblogic.jndi.internal
Library Name: wlfullclient.jar
Library Path: /Oracle/Middleware/wlserver_10.3/server/lib/wlfullclient.jar
===============================================

===============================================
Found: WLEventContextImpl
Class: weblogic.jndi.internal.WLEventContextImpl
Package: weblogic.jndi.internal
Library Name: weblogic.jar
Library Path: /Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar
===============================================

===============================================
Found: WLEventContextImpl
Class: weblogic.jndi.internal.WLEventContextImpl
Package: weblogic.jndi.internal
Library Name: wlthint3client.jar
Library Path: /Oracle/Middleware/wlserver_10.3/server/lib/wlthint3client.jar




I get the one in weblogic.jar, decompile the weblogic.jndi.internal.WLEventContextImpl class, and find that there is no debug statement in it.... I add some sysout in the lookup and copyObject methods to find out which class is causing the error, and copy the modified weblogic.jar back...

my patched class file is in /home/osb/workspacePVPreMaven/WLPatchForMQ/bin/weblogic/jndi/internal/WLEventContextImpl.class

I run these commands to copy the 3 jars in a temp directory and patch them:

cp /home/osb/workspacePVPreMaven/WLPatchForMQ/bin/weblogic/jndi/internal/WLEventContextImpl.class ./weblogic/jndi/internal/WLEventContextImpl.class

cp /Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar .
cp /Oracle/Middleware/wlserver_10.3/server/lib/wlfullclient.jar .
cp /Oracle/Middleware/wlserver_10.3/server/lib/wlthint3client.jar .
cp wlfullclient.jar wlfullclient.jar.ORI
cp weblogic.jar weblogic.jar.ORI
cp wlthint3client.jar wlthint3client.jar.ORI


jar uvf weblogic.jar weblogic/jndi/internal/WLEventContextImpl.class
cp weblogic.jar /Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar

jar uvf wlfullclient.jar weblogic/jndi/internal/WLEventContextImpl.class
cp wlfullclient.jar /Oracle/Middleware/wlserver_10.3/server/lib/wlfullclient.jar

jar uvf wlthint3client.jar weblogic/jndi/internal/WLEventContextImpl.class
cp wlthint3client.jar /Oracle/Middleware/wlserver_10.3/server/lib/wlthint3client.jar



and to restore the files:

cp weblogic.jar.ORI /Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar
cp wlfullclient.jar.ORI /Oracle/Middleware/wlserver_10.3/server/lib/wlfullclient.jar
cp wlthint3client.jar.ORI /Oracle/Middleware/wlserver_10.3/server/lib/wlthint3client.jar


Unfortunately the patch WORKS and traces the calls to JNDI lookups, but the decompilation must have messed it up because itcannot find a queue and the WLS crashes.

With some terror I discover that connector.jar delivered with MQ 7 dates back to 2001 (JDK 1.3) and providerutil.jar dates back to 2000 (JDK 1.2).

Enabling EJB, JMS, JNDI, ClassLoader flags doesn't help. Most likely the remote JMS destination deserialization fails.



Jan-2011: interesting post here http://weblogic-wonders.com/weblogic/2010/11/24/weblogic-foreign-jms-server-configuration-with-mq-series/

Tuesday, August 17, 2010

WebLogic integration with MQ series using JMS Foreign Server

I am taking some notes just to track:

http://www.ibm.com/developerworks/websphere/library/techarticles/0604_kesavan/0604_kesavan.html

one must configure the MDB to use a foreign JMS connection factory in addition to the foreign JMS
destination.


Error getting JMSServer member info NestedException Message is :javax.naming.Reference

http://ibswings.blogspot.com/2008/02/integrating-mq-broker-6-with-bea.html

If MQ and WLS are NOT on the same box, make sure you choose the transport=MQClient on MQ, this will generate a .bindings file totally different from the previous one; remember to copy this file to WebLogic.



To verify that your MDB is actually registered as a consumer of the MQ queue, "check value of IPProcs attribute in queue. This value gives the current number of threads listening for messages. If this value is 0 then there is no thread listening. " ( I am quoting a OTN thread)


This http://blog.xebia.com/2009/12/02/restricting-the-number-of-jms-mq-connections-made-by-the-osb/ is a very interesting reading on how to configure the number of listeners on the MQ queue.


This script is useful to create the resources:

cd('/')
cmo.createJMSSystemResource('MQIntegrationTest')

cd('/SystemResources/MQIntegrationTest')
set('Targets',jarray.array([ObjectName('com.bea:Name=dev2WlsCBMs1,Type=Server')], ObjectName))

cd('/JMSSystemResources/MQIntegrationTest/JMSResource/MQIntegrationTest')
cmo.createForeignServer('MQTestForeignServer')

cd('/JMSSystemResources/MQIntegrationTest/JMSResource/MQIntegrationTest/ForeignServers/MQTestForeignServer')
cmo.setDefaultTargetingEnabled(true)
cmo.setConnectionURL('file:////acme/domains/dev2WlsCBDomain/mqjndistuff')
cmo.setInitialContextFactory('com.sun.jndi.fscontext.RefFSContextFactory')
cmo.unSet('JNDIPropertiesCredentialEncrypted')
cmo.createForeignDestination('ReceiverDetails')

cd('/JMSSystemResources/MQIntegrationTest/JMSResource/MQIntegrationTest/ForeignServers/MQTestForeignServer/ForeignDestinations/ReceiverDetails')
cmo.setLocalJNDIName('jms/WLReceiverQueue')
cmo.setRemoteJNDIName('MQSenderQueue')

cd('/JMSSystemResources/MQIntegrationTest/JMSResource/MQIntegrationTest/ForeignServers/MQTestForeignServer')
cmo.createForeignConnectionFactory('ReceiverCF')

cd('/JMSSystemResources/MQIntegrationTest/JMSResource/MQIntegrationTest/ForeignServers/MQTestForeignServer/ForeignConnectionFactories/ReceiverCF')
cmo.setLocalJNDIName('jms/WLReceiverQCF')
cmo.setRemoteJNDIName('MQSenderQCF')

activate()