3 Replies Latest reply: Jul 13, 2011 5:04 AM by Nigeldeakin-Oracle RSS

    OpenMQ/imqadmin issue - objects disappear from Object Store

    874751
      Hello community,

      I am a beginner developer, and in the process of learning how to use OpenMQ within a Glassfishv3 environment to support the development of a user "keyphrase" messaging application. My basic set up is Windows 7 + Glassfish v3.1 + Eclipse Helios + MySQL 5.1.

      I have encountered a problem with the imqadmin console - newly created administered objects (that do exist within a file-based persistent Object Store!) disappear from view.

      I have successfully completed a number of tutorials (notably the OpenMQ Admin Guide and JavaEE6 with Glassfish textbook chapter on JMS) and maanged to develop a set of standalone applications that successfully implement the publish-subscribe messaging model using Glassfish. Each of these developments has relied upon the default JMS settings and OpenMQ broker (port 7676, imqbroker within domain1).

      I recently set about creating a non-default broker instance in a new Glassfish domain. In terms of Glassfish administration, I conducted the following steps from the command prompt (Glassfish bin and openmq bin directories are on my PATH variable):

      1. asadmin start-domain domain1
      2. asadmin create-domain testDomain --adminport 5000 (user = admin, password = admin)
      3. asadmin jms-ping -p 5000
      4. asadmin start-domain testDomain

      Glassfish asasdmin auto-detects domain1 operating on default ports, and auto-allocates ports for JMS and other services.

      The auto-generated OpenMQ broker instance in the <GlassfishInstallDir>/domains/testDomain/imq directory can be viewed in a file explorer. We can also inspect Glassfish Admin console at http://localhost:5000.

      I appreciate (but dont fully understand!) the difference between using the OpenMQ admin tools versus Glassfish admin tools, but as I was familiar with the OpenMQ tools - and they appear much more powerful - I opted to use them for JMS admin. This post from nigeldeakin [http://www.java.net/node/693523] was really useful on this matter, as I was left a little puzzled between the OpenMQ and Glassfish Admin Guides.

      With a new domain and JMS service active, I used the imqadmin admin console GUI to perform the following steps:

      1. Create a new broker named TestBroker, configured to the port assigned to JMS in the TestDomain (user = admin, password = admin)
      2. Connect to TestBroker
      3. Create a new physical destination named TestTopicDest within TestBroker and set limitBehavior to REMOVE_OLDEST.
      4. Create a file-based persistent Object Store, named TestObjectStore:
      (i) Create a directory called tempStore within the <GlassfishInstallDir>/domains/testDomain/imq/ directory
      (ii) Configure:: java.naming.factory.initial = com.sun.jndi.fscontext.RefFSContextFactory
      (iii) Configure:: java.naming.provider.url property = file:///<GlassfishInstallDir>/domains/testDomain/imq/tempStore
      5. Connect to TestObjectStore

      With a successful connection, I then created two administered objects:

      6. Create a ConnectionFactory named jms/TestConnectionFactory. I made sure the *3.0 Connection Handling* tab is correctly configured to the JMS port assigned by Glassfish for testDomain, as the default is 7676.

      7. Create a Topic administered object in TestObjectStore named jms/TestTopic.

      I then wrote a simple test application (A glassfish client with openmq libraries on the build path, publisher and subscriber classes both using an appropriately configure InitialConext via property value pairs in a hashmap). The publisher sends 100 TextMessage objects to jms/TestTopic, and the subscriber implements the MessageListener interface, where the onMessage method simply prints the textMessage string to the command line. This application works without issue, and I can post the code for those interested.

      However, when I refreshed the connection to the TestObjectStore, jms/TestConnectionFactory and jms/TestTopic disappear from view. I then close down the admin console and re-run imqadmin and re-connect to TestObjectStore, the objest are still not visible.

      To check TestObjectStore content, I tried to add another ConnectionFactory with the same as before - jms/TestConnectionFactory. The Admin Console warned me that the object store already contains a resource of that name. It seems strange that the console is "aware" of the objects in terms of file "write", but does not seem to update the UI components with a "read".

      I suspect that this problem is related to the use of a MySQL persitent store for the broker defined in the default Glassfish domain domain1, or to the use of the <GlassfishInstallDir>/domains/testDomain/imq directory - it is a feature that did not appear when following the tutorial material using the default <GlassfishInstallDir>domain1/imqbroker broker. I have not yet tested these ideas, nor have I check to see if I can replicate the behaviour on a completely new installation.

      I wondered if the community was aware of this, and whether I have missed something during set-up, or if this is a known issue?

      Any ideas and suggestions welcome.

      Many thanks,

      Ant
        • 1. Re: OpenMQ/imqadmin issue - objects disappear from Object Store
          Nigeldeakin-Oracle
          Ant,
          With a new domain and JMS service active, I used the imqadmin admin console GUI to perform the following steps:

          1. Create a new broker named TestBroker, configured to the port assigned to JMS in the TestDomain (user = admin, password = admin)
          2. Connect to TestBroker
          3. Create a new physical destination named TestTopicDest within TestBroker and set limitBehavior to REMOVE_OLDEST.
          4. Create a file-based persistent Object Store, named TestObjectStore:
          (i) Create a directory called tempStore within the <GlassfishInstallDir>/domains/testDomain/imq/ directory
          (ii) Configure:: java.naming.factory.initial = com.sun.jndi.fscontext.RefFSContextFactory
          (iii) Configure:: java.naming.provider.url property = file:///<GlassfishInstallDir>/domains/testDomain/imq/tempStore
          5. Connect to TestObjectStore

          With a successful connection, I then created two administered objects:

          6. Create a ConnectionFactory named jms/TestConnectionFactory. I made sure the *3.0 Connection Handling* tab is correctly configured to the JMS port assigned by Glassfish for testDomain, as the default is 7676.

          7. Create a Topic administered object in TestObjectStore named jms/TestTopic.
          You may have hit a bug in imqadmin, which doesn't appear to be handling the / character correctly. If you simply use the name TestTopic it should work.

          Nigel
          • 2. Re: OpenMQ/imqadmin issue - objects disappear from Object Store
            874751
            Nigel,

            Thank you very much for the helpful and rapid response. You are 100% correct - the / character is the culprit.

            I repeated my setup procedure with a new domain, and created objects with and without the / character. imqadmin worked as expected with the "non /" objects, and those with / characters disappeared.

            Interestingly, when I used the imqobjmgr list command on the broker, it does not return objects which include a / character. However, an explicit imqobjmgr query -l "jms/TestTopic" does return details of the jms/TestTopic object.

            I'd be interested in learning more about bugs and known issues. Do you maintain a public bug-tracking system for OpenMQ? If so, could you send a link?

            Thank you once again,

            Ant
            • 3. Re: OpenMQ/imqadmin issue - objects disappear from Object Store
              Nigeldeakin-Oracle
              I'd be interested in learning more about bugs and known issues. Do you maintain a public bug-tracking system for OpenMQ? If so, could you send a link?
              Yes. Please feel free to log this as a bug.
              http://java.net/jira/browse/MQ
              You need to register with java.net first.

              Also see http://mq.java.net

              Nigel