5 Replies Latest reply on Nov 21, 2006 11:46 PM by bashbish

    How to make MDB listen on weblogic queue

    ajp10304

      Hi,

      I am new to MDBs and JBoss and need a little help. I need to get my MDB to listen on a queue currently set up in weblogic. I know in weblogic I would have to configure a new ForeignJMSServer via the console. What is the equivalent set up required in JBoss?

      Any help greatly appreciated.

      Regards,

      Alan.

        • 1. Re: How to make MDB listen on weblogic queue
          romanchr

          Hi Alan,

          What you need is a JMSProvider that access Weblogic. There are examples how you can achieve this for Tibco. My guess is you can do it the same way. If you want you can also check out my own topic in this forum (Tibco messaging integration fails). What you mainly need is, as mentioned before, a JMS Provider. after this one is configured you just need to adjust your bean in using this new message provider.

          Regards

          Christoph

          • 2. Re: How to make MDB listen on weblogic queue
            ajp10304

            Thanks for putting me on the right track. I've followed the guidlines as best I could but I get:

            javax.naming.NameNotFoundException: DefaultJMSProvider not bound

            Would you have any idea what the most likely cause of this is?

            Cheers,

            Alan.

            • 3. Re: How to make MDB listen on weblogic queue
              weston.price

              Could you post your jms-ds.xml file?

              Also your ejb-jar.xml and jboss.xml files. Also, JBoss version as well.

              • 4. Re: How to make MDB listen on weblogic queue
                ajp10304

                I'm running jboss-4.0.3SP1.

                I have created a weblogic-jms-ds.xml as below:

                <?xml version="1.0" encoding="UTF-8"?>
                
                <connection-factories>
                
                 <!-- ==================================================================== -->
                 <!-- JMS Weblogic Stuff -->
                 <!-- ==================================================================== -->
                
                 <!-- The JMS provider loader -->
                 <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
                 name=":service=JMSProviderLoader,name=WeblogicJMSProvider">
                
                 <attribute name="ProviderName">WeblogicJMSProvider</attribute>
                
                 <attribute name="ProviderAdapterClass">
                 org.jboss.jms.jndi.JNDIProviderAdapter
                 </attribute>
                
                 <attribute name="QueueFactoryRef">QueueConnectionFactory</attribute>
                
                 <attribute name="TopicFactoryRef">TopicConnectionFactory</attribute>
                
                 <attribute name="Properties">
                 java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
                 java.naming.provider.url=t3://ifdwebapp1:7901
                 </attribute>
                
                 </mbean>
                
                
                 <mbean code="org.jboss.naming.NamingAlias"
                 name="DefaultDomain:service=NamingAlias,fromName=QueueConnectionFactory">
                
                 <attribute name="ToName">t3://ifdwebapp1:7901/QueueConnectionFactory</attribute>
                 <attribute name="FromName">QueueConnectionFactory</attribute>
                
                 </mbean>
                
                </connection-factories>



                jboss.xml is
                <?xml version="1.0" encoding="UTF-8"?>
                <jboss>
                 <enterprise-beans>
                 <message-driven>
                 <ejb-name>SwitchMDBBean</ejb-name>
                 <destination-jndi-name>svf-request</destination-jndi-name>
                 </message-driven>
                 </enterprise-beans>
                
                 <resource-ref>
                 <res-ref-name>jms/svf-request</res-ref-name>
                 <jndi-name>QueueConnectionFactory</jndi-name>
                 </resource-ref>
                
                 <resource-ref>
                 <res-ref-name>jms/svf-response</res-ref-name>
                 <jndi-name>QueueConnectionFactory</jndi-name>
                 </resource-ref>
                
                </jboss>
                



                ejb-jar.xml:
                <?xml version="1.0" encoding="UTF-8"?>
                <ejb-jar version="2.1" 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">
                 <display-name>SwitchMDB-ejb</display-name>
                 <enterprise-beans>
                
                 <message-driven>
                 <display-name>SwitchMDBMDB</display-name>
                
                 <ejb-name>SwitchMDBBean</ejb-name>
                 <ejb-class>uk.co.ifdsgroup.jms.SwitchMDBBean</ejb-class>
                 <transaction-type>Container</transaction-type>
                 <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
                
                 <message-driven-destination>
                 <destination-type>javax.jms.Queue</destination-type>
                 <subscription-durability>NonDurable</subscription-durability>
                 </message-driven-destination>
                
                 <!--<message-destination-type>javax.jms.Queue</message-destination-type>
                 <message-destination-link>svf-request</message-destination-link>
                 <activation-config>
                 <activation-config-property>
                 <activation-config-property-name>acknowledgeMode</activation-config-property-name>
                 <activation-config-property-value>Auto-acknowledge</activation-config-property-value>
                 </activation-config-property>
                 <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>-->
                
                 <env-entry>
                 <env-entry-name>jndi-initial-context-factory</env-entry-name>
                 <env-entry-type>java.lang.String</env-entry-type>
                 <env-entry-value><![CDATA[weblogic.jndi.WLInitialContextFactory]]></env-entry-value>
                 </env-entry>
                 <env-entry>
                 <env-entry-name>jndi-provider-url</env-entry-name>
                 <env-entry-type>java.lang.String</env-entry-type>
                 <env-entry-value><![CDATA[t3://ifdwebapp1:7901]]></env-entry-value>
                 </env-entry>
                
                 </message-driven>
                
                 </enterprise-beans>
                
                
                 <assembly-descriptor>
                 <container-transaction>
                 <method>
                 <ejb-name>SwitchMDBBean</ejb-name>
                 <method-name>*</method-name>
                 </method>
                 <trans-attribute>Required</trans-attribute>
                 </container-transaction>
                 <!-- <message-destination>
                 <display-name>Destination for SwitchMDB</display-name>
                 <message-destination-name>SwitchMDBDestination</message-destination-name>
                 </message-destination>-->
                 </assembly-descriptor>
                </ejb-jar>


                standardjboss.xml snippet:
                <invoker-proxy-binding>
                 <name>singleton-message-driven-bean</name>
                 <invoker-mbean>default</invoker-mbean>
                 <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
                 <proxy-factory-config>
                 <!--<JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>-->
                
                 <JMSProviderAdapterJNDI>WeblogicJMSProvider</JMSProviderAdapterJNDI>
                
                 <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
                 <CreateJBossMQDestination>true</CreateJBossMQDestination>
                 <!-- WARN: Don't set this to zero until a bug in the pooled executor is fixed -->
                 <MinimumSize>1</MinimumSize>
                 <MaximumSize>1</MaximumSize>
                 <KeepAliveMillis>30000</KeepAliveMillis>
                 <MaxMessages>1</MaxMessages>
                 <MDBConfig>
                 <ReconnectIntervalSec>10</ReconnectIntervalSec>
                 <DLQConfig>
                 <DestinationQueue>t3://ifdwebapp1:7901/queue/DLQ</DestinationQueue>
                 <MaxTimesRedelivered>10</MaxTimesRedelivered>
                 <TimeToLive>0</TimeToLive>
                 </DLQConfig>
                 </MDBConfig>
                 </proxy-factory-config>
                 </invoker-proxy-binding>


                jndi.properties:
                # DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING
                #
                java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
                java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces:weblogic.jndi.factories
                


                Thanks for your help with this.
                - Alan.

                • 5. Re: How to make MDB listen on weblogic queue
                  bashbish

                  I tried to get this to work but ran into classloader issues. Weblogic provides a wlclient.jar and wljmsclient.jar. Adding this to jboss-services.xml classpath causes problems.

                  My work-around was to use Spring Message Driven Pojos in a war file were I have more control over classloading.

                  Any follow-up on getting WebLogic loaded as a JMS provider?