2 Replies Latest reply: Jun 27, 2008 9:06 AM by 666705 RSS

    MDB not connecting to Foreign JMS destination

    666705
      I'm running WL 9.2 MP3 on Windows machine. I'm deploying a rudimentary MDB congured against as Foreign Service JMS provider against MQ V6.0 with local queue running on the same local machine.
                
                I'm using Maven2 to build all the sub-projects - including my ejb project and enterprise application project. The EAR file deploys successfully without any errors (one minor warning about lack of explicity transactionsi in onMessage() method...). I don't see any errors but my MDB Connection Status is "disconnected" - I've enabled Debug for key sections under default and weblogic sections - still not errors of any kind but it does not connect! What can I do to find the problem?!
                
                
                Here is my EJB definition:
                ------------------------------------------------------------------
                
                public class AnotherBean extends GenericMessageDrivenBean implements
                          MessageDrivenBean, MessageListener {
                     private static final long serialVersionUID = 1L;
                
                     /* When the bean is activated, this method will be invoked
                     * @see javax.jms.MessageListener#onMessage(javax.jms.Message)
                     */
                     public void onMessage(Message msg) {
                          System.out.println("\n=========================================");
                          System.out.println("=> Message received!");
                
                          if (msg instanceof TextMessage) {
                
                               try {
                                    System.out.println("=> Message: "
                                              + ((TextMessage) msg).getText());
                               } catch (JMSException e) {
                                    e.printStackTrace();
                               }
                          }
                
                          // Place the message on to the reply queue (WLReplyQueue)
                          System.out.println("=========================================");
                     }
                }
                --------------------------------------------------------------------
                
                Here is my ejb-jar.xml:
                ------------------------------------------------------------------
                <ejb-jar
                xmlns="http://java.sun.com/xml/ns/j2ee"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
                version="2.1">
                <enterprise-beans>
                <message-driven>
                <ejb-name>AnotherBean</ejb-name>
                <ejb-class>com.ibm.myclient.gems.ejb.AnotherBean</ejb-class>
                <transaction-type>Container</transaction-type>
                <activation-config>
                <activation-config-property>
                <activation-config-property-name>destinationType</activation-config-property-name>
                <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
                </activation-config-property>
                </activation-config>
                </message-driven>
                </enterprise-beans>
                </ejb-jar>
                ------------------------------------------------------------------
                
                Here is my weblogic-ejb-jar.xml:
                <weblogic-ejb-jar
                xmlns="http://www.bea.com/ns/weblogic/90" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">
                <weblogic-enterprise-bean>
                <ejb-name>AnotherBean</ejb-name>
                <message-driven-descriptor>
                <destination-jndi-name>jms/WLReceiverQueue</destination-jndi-name>
                <connection-factory-jndi-name>jms/WLReceiverQCF</connection-factory-jndi-name>
                </message-driven-descriptor>
                </weblogic-enterprise-bean>
                </weblogic-ejb-jar>
                
                WL JMS module is setup like this:
                ---------------------------------------------------------
                <weblogic-jms xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schema
                Location="http://www.bea.com/ns/weblogic/920 http://www.bea.com/ns/weblogic/920.xsd">
                <foreign-server name="MQTestForeignServer">
                <default-targeting-enabled>true</default-targeting-enabled>
                <foreign-destination name="ReceiverDetails">
                <local-jndi-name>jms/WLReceiverQueue</local-jndi-name>
                <remote-jndi-name>MQSenderQueue</remote-jndi-name>
                </foreign-destination>
                <foreign-destination name="ReplyDetails">
                <local-jndi-name>jms/WLReplyQueue</local-jndi-name>
                <remote-jndi-name>MQReceiverQueue</remote-jndi-name>
                </foreign-destination>
                <foreign-connection-factory name="ReceiverCF">
                <local-jndi-name>jms/WLReceiverQCF</local-jndi-name>
                <remote-jndi-name>MQSenderQCF</remote-jndi-name>
                </foreign-connection-factory>
                <foreign-connection-factory name="ReplyCF">
                <local-jndi-name>jms/WLReplyQCF</local-jndi-name>
                <remote-jndi-name>MQReceiverQCF</remote-jndi-name>
                </foreign-connection-factory>
                <initial-context-factory>com.sun.jndi.fscontext.RefFSContextFactory</initial-context-factory>
                <connection-url>file:/ C:/JNDI-Directory</connection-url>
                </foreign-server>
                </weblogic-jms>
        • 1. Re: MDB not connecting to Foreign JMS destination
          666705
          I assume you've verified in the MQ JMSAdmin tool that the file at c:/JNDI-Directory/.bindings correctly specifies QCFs MQSenderQCF and MQReceiverQCF and queues MQSenderQueue and MQReceiverQueue? Since you appear to be on Windows, use SysInternals ProcessMonitor to watch whether WebLogic reads your ".bindings" file.
          • 2. Re: MDB not connecting to Foreign JMS destination
            666705
            Thanks for the tips - I solved the problem. I first recreated my .bindinds file making sure that both QCF objects are in there (it turned out that only ONE of them was there and not the other). Next, I also removed an extra space " " from the URL reference in the Foreign JMS service setup in the console:
                      
                      was like this initially:
                      <connection-url>file:/ C:/JNDI-Directory</connection-url>
                      
                      and I changed it to this - removing single space after first "/":
                      <connection-url>file:/C:/JNDI-Directory</connection-url>
                      
                      Restarted the whole thing and it worked! Thanks again.