7 Replies Latest reply: Apr 26, 2012 7:15 AM by 853580 RSS

    InvalidClientIdException while creating Durable subscription in weblogic


      We have scenario to create a durable subscription for an MDB. Here application in weblogic is a subscriber to a Topic present on the Progress Sonic. For integrating to independent platforms we are using Foreign Server mechanism under JMS Modules.
      For creating durable subscription, we have changed the MDB code . Below is the MDB code,

      package com.test;

      import java.util.Enumeration;

      import javax.annotation.Resource;
      import javax.annotation.Resources;
      import javax.ejb.MessageDriven;
      import javax.ejb.TransactionAttribute;
      import javax.ejb.TransactionAttributeType;
      import javax.ejb.TransactionManagement;
      import javax.ejb.TransactionManagementType;
      import javax.jms.Message;
      import javax.jms.MessageListener;
      import javax.jms.TextMessage;
      import javax.ejb.ActivationConfigProperty;

      * Message-Driven Bean implementation class for: TestMDB
      @MessageDriven(description = "mdb for Airline Schedule Change MDB",
      name = "AirlineScheduleMDB",
      activationConfig = {
      @ActivationConfigProperty(propertyName = "destinationType",
      propertyValue = "javax.jms.Topic"),
      @ActivationConfigProperty(propertyName = "subscriptionDurability",
      propertyValue = "Durable")
      @TransactionManagement(value = TransactionManagementType.CONTAINER)
      @Resources( { @Resource(name = "ConnectionFactoryRef",
      mappedName = "TopicConnectionFactory",
      type = javax.jms.ConnectionFactory.class) })
      public class TestMDB implements MessageListener {

      * @see MessageListener#onMessage(Message)
      @TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED)
      public void onMessage(Message message) {

      System.out.println("Inside message : ");

      try {
      Enumeration<Object> messageProperty = message.getPropertyNames();
      System.out.println("The request : "+message);

      if(message != null){
      System.out.println("TestMDB : onMessage : Start");
      System.out.println("Received Input message is empty");
      } catch (Exception e) {
      System.out.println("Exception Occurred in TestMDB : ");
      System.out.println("TestMDB : onMessage : End.Time taken is :");


      Also the following change was included in the weblogic-ejb-jar.xml.

      <?xml version="1.0" encoding="UTF-8"?>
      xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">

      Exception we got :
      <03-Apr-2012 18:11:02 o'clock UTC> <Warning> <EJB> <BEA-010061> <The Message-Driven EJB: TestMDB is unable to connect to the JMS destination: DurableJNDI. The Error was:
      javax.jms.InvalidClientIDException: Invalid client id: DurableTest_drdevwls_TestDomain-wls1_CLEARCF.jarTestMDB

      Weblogic is automatically creating a unique id based on the combination of Adminserver/Managedserver/Projectname etc.
      However the id created by weblogic seems to have a dot(.) which as per Sonic spec is an invalid character.
      eg:- DurableTest_test_domain_AdminServer_CLEARCF.jarTestMDB

      Hence we changed the parameter to false and provided our own value.


      At this point of time we were able to see that MDB have created a Durable subscription successfully and it worked as expected.

      However when we tried to scale this change to multiple managed servers, there were errors thrown from sonic side.

      javax.jms.JMSException: [129] progress.message.client.EUserAlreadyConnected: Administrator/$DURABLE$DurableTest$DurableTest

      So we cannot have same clientid for multiple clients(managed server). We arent sure how to proceed with this.

      We need to find a way to remove the dot from the dynamic id weblogic creates.

      Any help on this is highly appreciated.
        • 1. Re: InvalidClientIdException while creating Durable subscription in weblogic
          Which version of WebLogic server are you using? It sounds like a product bug to me. You may want to contact Oracle customer service.

          If you are using WLS 10.3 PS3 and later, you may consider use the advanced topic features in MDB, which does not require using generate-unique-client-id. The details can be found at http://docs.oracle.com/cd/E17904_01/web.1111/e15493/dist_topics.htm#CBHHCEIG
          • 2. Re: InvalidClientIdException while creating Durable subscription in weblogic
            Tom B
            It is unfortunate that WebLogic uses a "." character in generated client-ids, but, IIRC, this is allowed by the JMS specification.

            As a work-around to Sonic's client-id-in-use exception, Sonic may have an extension that allows multiple clients to share the same client-id (not an uncommon option although it's technically not JMS spec compliant - WL JMS has one).

            Are you trying to have each WebLogic server get a copy of each topic message (a "one-copy-per-server" pattern), or are your trying to have only one copy of each message processed per WebLogic cluster (a "one-copy-per-app" pattern)? The former is the intended use case for the generate-unique-jms-client-id option. The latter is likely what you'll end up with if Sonic does happen to have a shared client-id option.

            Alternatively, if you have the option of using WebLogic's JMS provider instead of Sonic, then you can use the enhanced topic features that Dongbo mentioned.

            • 3. Re: InvalidClientIdException while creating Durable subscription in weblogic
              Hi Dongbo,

              We are using weblogic version 10.3.3, we were not sure whether inclusion of a '.' is a bug or not. However as per TomB this is inlcuded in the JMS specification. In our case we cannot use the advance topic features as our applications has to use the Sonic Topics rather than weblogic topics.

              Thanks & Regards,
              Bharat K
              • 4. Re: InvalidClientIdException while creating Durable subscription in weblogic
                Hi TomB,

                We have tried raising a ticket with sonic however they have rejected the same as it has been already mentioned in their specification that inlusion of '.' is not allowed. Hence we are now in a catch22 position as sonic has rejected the ticket and weblogic is generating a '.' in its ID.
                Is there any other way where we can override the ID which is generated by weblogic.

                We have to use the "one-copy-per-server" pattern.

                Thanks & Regards,
                Bharat K
                • 5. Re: InvalidClientIdException while creating Durable subscription in weblogic
                  Tom B
                  I don't know of a way to remove the dot.

                  A work-around could be to deploy a different MDB to each server, each with a different client-id.

                  Another could be to configure multiple Sonic CFs, each with a different client-id (most vendors allow configuring a client-I'd in their CFs), configure a Foreign JMS Server with a same-named CF per WL Server - each with a reference to a unique Sonic CF, and finally ensure that the MDB uses the local CF name.


                  • 6. Re: InvalidClientIdException while creating Durable subscription in weblogic
                    Hi Tom,

                    Thanks for your suggestions, we will try to work on this and let you know the result.

                    Thanks & Regards,
                    Bharat K
                    • 7. Re: InvalidClientIdException while creating Durable subscription in weblogic
                      Hi Tom,

                      We have found the solution to this problem and thanks for your suggestion that has partially helped us in solving the problem.
                      As you have suggested we have defined client-id on the connection factory however we will be having only connection factory instead of multiple with different client-ID's.
                      Along with the client-id configured at the connection factory level we are now setting the attributes generate-unique-client-id as true at the weblogic end.
                      By doing this way, I assume that weblogic while making the durable subscription connection is passing the uniquely generated client ID (which has dots '.' included in it ) as subscription name and client-id will be same, that is defined on the connection factory.

                      A question may arise that - 'why is sonic accepting subscription name with dots but not the client-id ?' - When observed from the sonic end the dots in the subscription name are replaced by '@@@' .
                      Sonic need to answer the question of why the dots are being replaced for subscription name but not for client-id.

                      Bharat K