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.

Hi Aparajeetha, nice collection. And im new to this jms server and Aq.Can u pls help me how to send the jms topic messages to oracle AQ.
ReplyDeleteHi Johny. Am glad my blog interests you.
DeleteAm afraid, I didn't quite get your question. Here, I am sending a javax.jms.Message to an AQ Queue. What exactly do you mean by a 'jms topic message'. Message cannot be specific to a Queue or a Topic if thats what u mean?
Hi Aparajeeta,
ReplyDeleteI followed the steps mentioned above and now after restart my jms config file looks ok with db_url and java.naming.security.principal added, but still while executing my java class sendQueue , receiveQueue I am getting the same error as earlier :
Exception in thread "main" javax.naming.NamingException: The configuration of the AQjmsInitialContext is not complete. The configuration must contain datasource or (db_url,java.naming.security.principal,java.naming.security.credentials) or both
Please guide me where I am going wrong.
Waiting for quick reply.
Thanks in advance.