3 Replies Latest reply on Apr 27, 2006 1:26 AM by steve lau

    JBoss register Weblogic Topic mini-howto

    ftftft Newbie

      My solution is not good enough as a patch, but it works. I post it here and hope someone can make it better.

      1. write a new WeblogicMQProvider.java. Use source code from ./server/src/main/org/jboss/jms/jndi/JBossMQProvider.java. but change the method getInitialContext() to provide weblogic JNDI context parameter

      2. create a weblogic-ds.xml in the deploy/jms. JBossConnectionFactory is the connection factory created in the weblogic server. also, you change ProviderUrl and ProviderAdapterClass as you wish.

      <?xml version="1.0" encoding="UTF-8"?>

      <connection-factories>

      <!-- The Weblogic JMS provider loader -->

      WeblogicJMSProvider

      WeblogicMQProvider

      t3://serverl:80
      JBossConnectionFactory
      JBossConnectionFactory


      </connection-factories>

      3. write a new JMSContainerInvoker.java. Copy code from /server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java. do some modification. This is not complete code. You should modify them a little a bit.

      Replace orginal code with the follow code in innerCreate().

      tsession =
      tConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      log.debug("Topic Session set up");

      // To be no-durable or durable
      if (config.getSubscriptionDurability() != MessageDrivenMetaData.DURABLE_SUBSCRIPTION)
      {
      // Create non durable
      tsubscriber = tsession.createSubscriber(topic);
      log.debug("Topic Subscriber set up");
      }
      else
      {
      // Durable subscription
      String durableName = config.getSubscriptionId();

      tsubscriber = tsession.createDurableSubscriber(topic,durableName);
      log.debug("Durable Topic Subscriber set up");
      }
      tsubscriber.setMessageListener(new MessageListenerImpl(this));
      log.debug("Topic Subscriber set up its listener");

      Replace orginal code with the follow code in innerStop().

      try
      {
      if ( tsession != null )
      {
      MessageDrivenMetaData config =
      ((MessageDrivenMetaData)container.getBeanMetaData());
      if (config.getSubscriptionDurability() == MessageDrivenMetaData.DURABLE_SUBSCRIPTION) {
      // Get configuration information - from EJB-xml
      String durableName = config.getSubscriptionId();
      tsession.unsubscribe(durableName);
      }
      }

      4. jboss.xml

      <message-driven>
      <ejb-name>blah blah</ejb-name>
      <destination-jndi-name>MessageTopic</destination-jndi-name>
      ~~~~~~~~~~ JNDI name in weblogic server
      <!-- the follow three lines is important-->
      <mdb-subscription-id>JBOSS-192.168.1.124</mdb-subscription-id>
      <mdb-client-id>QA-JBOSS-192.168.1.124</mdb-client-id>
      <configuration-name>JBossMDB</configuration-name>
      ... ....
      </message-driven>

      <invoker-proxy-bindings>
      <invoker-proxy-binding>
      WeblogicBinding
      <invoker-mbean>weblogic</invoker-mbean>
      <proxy-factory>JMSContainerInvoker</proxy-factory>
      <proxy-factory-config>
      java:/WeblogicJMSProvider
      StdJMSPool
      15
      1

      10

      </proxy-factory-config>
      </invoker-proxy-binding>
      </invoker-proxy-bindings>

      <container-configurations>
      <container-configuration>
      <container-name>RescueMDB</container-name>
      <call-logging>false</call-logging>
      <invoker-proxy-binding-name>WeblogicBinding</invoker-proxy-binding-name>
      <container-interceptors>
      org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor
      org.jboss.ejb.plugins.LogInterceptor
      org.jboss.ejb.plugins.RunAsSecurityInterceptor
      <!-- CMT -->
      org.jboss.ejb.plugins.TxInterceptorCMT
      org.jboss.ejb.plugins.MetricsInterceptor
      org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
      <!-- BMT -->
      org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor
      org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT
      org.jboss.ejb.plugins.MetricsInterceptor
      org.jboss.resource.connectionmanager.CachedConnectionInterceptor
      </container-interceptors>
      <instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
      <instance-cache></instance-cache>
      <persistence-manager></persistence-manager> <container-pool-conf>
      100 </container-pool-conf>
      </container-configuration>

      5. package the two java class. copy it and weblogic.jar into server/default/lib. I don't know why wlclient.jar doesn't work.

      Andira, I'm sorry that I don't have enough time to polish it better.

      brett

        • 1. Re: JBoss register Weblogic Topic mini-howto
          maxi72 Newbie

          Thanks, where i find the source :
          ./server/src/main/org/jboss/jms/jndi/JBossMQProvider.java and
          /server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java

          i'm using Jboss 3.2.3, and i will connect jboss MDB to queue on weblogic server.

          • 2. Re: JBoss register Weblogic Topic mini-howto
            ftftft Newbie

            Download JBoss source code. You will find it.

            "maxi72" wrote:
            Thanks, where i find the source :
            ./server/src/main/org/jboss/jms/jndi/JBossMQProvider.java and
            /server/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java

            i'm using Jboss 3.2.3, and i will connect jboss MDB to queue on weblogic server.


            • 3. Re: JBoss register Weblogic Topic mini-howto
              steve lau Newbie

              Hi, would like to ask I tried to follow the rules but it fails.
              I digged into it, found that weblogic doesn't allow remote call to create ConnectionConsumer which JMSContainerInvoker (a jboss class) would try to do. It throws with such a root exception:

              Caused by: weblogic.jms.common.IllegalStateException: connection consumer only supported on server
              at weblogic.jms.client.JMSConnection.createConnectionConsumer(JMSConnection.java:744)
              at weblogic.jms.client.JMSConnection.createConnectionConsumer(JMSConnection.java:479)
              at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerStartDelivery(JMSContainerInvoker.java:890)
              ... 155 more

              Which weblogic server you use and how do you solve the problem ?? I am currently using jboss 4.0.3 sp1 and weblogic 8.1 sp3

              I searched the bea forums & bea docs and found that someone stated ConnecctionConsumer cannot be initialized out of weblogic server. I decompiled the weblogic code and found that it checked the Kernel.isServer(), and I tried to cheat the weblogic server to set the KernelStatus.setIsServer(true), it throws something else too about serializing stuff which seems not a possible way to solve.

              Is there anyone who have some successful experience to share? Really appreciate your helps & thanks so much!!!!