title: How to use Java JMS Authentication only on ConnectionFactory
body: <p>I am currently deploying a REST application to publish messages to JMS but in order to connect thru the QueueConnectionFactory we are creating the context but we want to use the username and password which was defined on layer of Webpshere and JMS, bypassing the authentication on java code for createContext().</p>
  
  <p>I do not want to pass the authentication on java code, once the user and password was connected on JMS .</p>
  
  <p>Below is the code used:</p>
  
  <pre><code>    try {
  
          javax.naming.Context ctx = new InitialContext();
  
          QueueConnectionFactory jmsCF =  (QueueConnectionFactory) ctx.lookup("jms/bapssdEE/iwszQCF");
  
          Queue jmsQ = (Queue) ctx.lookup("jms/bapssdEE/iwszQ");
  
          // This part we are bypassing the authentication
          try (JMSContext context = jmsCF.createContext()) {
  
  
  }
  </code></pre>
  
  <p>When the program runs we are getting the following sysout on log :</p>
  
  <blockquote>
    <p>[12/4/18 22:00:31:170 BRST] 0000017d SibMessage    W<br>
    [BAP_BUS:productionbackupNode01.server1-BAP_BUS] CWSII0212W: The bus
    BAP_BUS denied an anonymous user access to the bus. [12/4/18
    22:00:31:249 BRST] 0000017d SystemOut     O &lt;&lt;&lt;---
    AutosysExecProvider.putRequestInJMSQueue method.</p>
  </blockquote>
  
  <p>I have setup the Username and password on Webpshere using the WAS path:
  Resources \ JMS \ Connection Factories \ New </p>