title: javax.jms.JMSSecurityException: MQJMS2008: failed to open MQ queue
body: <p>I have a JMS-based application that I am running in on Websphere 6.0, and am migrating to Websphere 7.  Both Websphere servers are backed with a Websphere MQ 6.0 server.  I receive the following exception when attempting to deploy a test servlet to the Websphere 7 server:</p>
  
  <p><strong><code>javax.jms.JMSSecurityException: MQJMS2008: failed to open MQ queue</code></strong></p>
  
  <p>Websphere 6.0 : RHEL 5.3 </p>
  
  <p>Websphere 7.0.0.15:  RHEL 5.3 </p>
  
  <p>Websphere MQ 6.0: Windows Server 2003 </p>
  
  <p>Servlet Test Code:</p>
  
  <pre><code>public class JMSTestServlet extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      /**
       * @see HttpServlet#HttpServlet()
       */
          String MQConnectionFactory, MQQueue; 
  
      public JMSTestServlet() {
          super();
          // TODO Auto-generated constructor stub
          System.out.println("JMSTestServlet: loading");
  
          URL urlProps = getClass().getClassLoader().getResource("META-INF/startup.properties");
          Properties props = new Properties();
          try
                  {
            System.out.println("JMSTestServlet: loading properties");
            props.load( urlProps.openStream() );
  
                      MQConnectionFactory = props.getProperty("MQConnectionFactory"); 
                      MQQueue = props.getProperty("MQQueue"); 
  
            System.out.println("JMSTestServlet: loading properties ... done!");
  
            sendMessage("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
                  } catch (IOException e)
                  {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  }
      }
  
      protected void sendMessage(String messageString) { 
          QueueConnectionFactory fact;
          QueueConnection qConn = null;
          try { 
              System.out.println("JMSTestServlet: creating context");
              Context ctx = new InitialContext();
              fact = (QueueConnectionFactory)ctx.lookup(MQConnectionFactory);
              Destination destination = (Destination)ctx.lookup(MQQueue);
  
              System.out.println("JMSTestServlet: creating QueueConnection");
              qConn = fact.createQueueConnection(); 
              QueueSession    qSess = qConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
              MessageProducer prod = qSess.createProducer(destination); 
  
  
              System.out.println("JMSTestServlet: sending Message");
              TextMessage message = qSess.createTextMessage();
              message.setText(messageString);
              prod.send(message); 
  
              System.out.println("JMSTestServlet: done sendMessage()");
          } catch ( JMSException ex ) {
              ex.toString(); 
              ex.printStackTrace();
              ex.getLinkedException().toString();
              ex.getLinkedException().printStackTrace();
          } catch ( NamingException ex ) {
              System.out.println("JMSTestServlet: naming exception " + ex.toString());
              ex.printStackTrace();
          } catch ( Exception ex ) {
            System.out.println("JNDI API lookup failed: " +         ex.toString());
              ex.printStackTrace();           
          } finally {
              System.out.println("JMSTestServlet: cleaning up sendMessage()");
  
              try
              {
                  if ( qConn != null ) qConn.close();
              } catch (JMSException e)
              {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
          }
      }
  
      /**
       * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          try { 
              String messageString = request.getParameter("message"); 
              sendMessage(messageString);
          } finally {
          }
      }
  </code></pre>
  
  <p>Properties file is: </p>
  
  <pre><code>MQConnectionFactory=jms/QUEUECONNFACTORY
  MQQueue=jms/QUEUE 
  </code></pre>
  
  <p>When deployed to Websphere 6 I get messages in my remote queues.  When I deploy to Websphere 7, I get: </p>
  
  <pre><code>[4/13/11 14:53:55:622 EDT] 0000005c ConnectionEve A   J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource JMS$QUEUECONNFACTORY$JMSManagedConnection@15. The exception is: javax.jms.JMSSecurityException: MQJMS2008: failed to open MQ queue 'QUEUE'.
  [4/13/11 14:53:55:622 EDT] 0000005c ConnectionEve W   J2CA0206W: A connection error occurred.  To help determine the problem, enable the Diagnose Connection Usage option on the Connection Factory or Data Source.
  [4/13/11 14:53:55:623 EDT] 0000005c ConnectionEve A   J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource jms/QUEUECONNFACTORY. The exception is: javax.jms.JMSSecurityException: MQJMS2008: failed to open MQ queue 'QUEUE'.
  [4/13/11 14:53:55:625 EDT] 0000005c SystemErr     R   javax.jms.JMSSecurityException: MQJMS2008: failed to open MQ queue 'QUEUE'.
  </code></pre>
  
  <p>I'm pretty sure I've configured the queues and connection factories on both Websphere servers the same.  I'm at a loss as to how to resolve this issue, and the Google is of no help.  </p>
  
  <p><strong>Update 2011-04-15:</strong></p>
  
  <p>I've extracted the following error from the logs: </p>
  
  <blockquote>
    <p><code>com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2035'</code></p>
  </blockquote>
  
  <p>I've read up on it at a few locations, and I really can't see where there's a difference between WAS 6 and WAS 7 to cause this issue. </p>
  
  <p>I'm running Websphere on both Linux hosts as root.  I have a root account created on the Windows machine with full permissions to the MQ installation: </p>
  
  <blockquote>
    <p><code>setmqaut -t qmgr -m QM_webspheremq -p root +all</code></p>
  </blockquote>