The oracle docs will provide the config details through which it is easy to connect to a JMS adapter from BPEL using the adapter's outbound connection pool JNDI and Queue JNDI as inputs. But I wanted to connect to an AQ from a Java client using the QueueConnectionFactory and Queue JNDI, both configured as a part of the Foreign Server. The docs mention that to connect to an AQ Queue, change the Foreign Server initial context to the Aqjms context and proceed with providing the JNDI property key and value for the datasource.
Even though the mentioned configuration will help you connect to a Queue through JMS adapter from BPEL, it will not help you connect the same Queue through a standalone client using server context. To achieve the same, you must add the db_url and java.naming.security.principal as the keys and the jdbc connection url and the DB user as the values respectively as mentioned in the link http://download.oracle.com/docs/cd/E12839_01/web.1111/e13738/aq_jms.htm#JMSAD565 under the topic "Stand-alone WebLogic AQ JMS Clients" and "Configure a Foreign Server using a Database's JDBC URL".
To elaborate the same, earlier my jms config.xml had a ForeignServer configuration as below:
<foreign-server name="11GEvalForeignServer">
.
.
.
<initial-context-factory> oracle.jms.AQjmsInitialContextFactory</initial-context-factory>
<jndi-properties-credential-encrypted>{AES}TqzwTRUIKdpaT/wgp5OiNU85BlmhrEJiu/z/p3EofWo=</jndi-properties-credential-encrypted>
<jndi-property>
<key>datasource</key>
<value>jdbc/11GEvalJMSUserDataSource</value>
</jndi-property>
</foreign-server>
...but later I added the jdbc url and user to it as follows :
<jndi-property>
<key>java.naming.security.principal<key>
<value>jmsuser</value>
</jndi-property>
<jndi-property>
<key>db_url<key>
<value>jdbc:oracle:thin:@10.209.125.21:1521/ORCL1</value>
</jndi-property>
and Voila! the standalone client just worked !! In short, it is the limitation of the standalone client support as mentioned in the same link mentioned above, section "Limitations when using Stand-alone WebLogic AQ JMS Clients", point 3.
Here is my Java code that connects to the Queue.
