Question

I testing setting up a web logic server which can use an Oracle AQ JMS implementation, but for some reason my WLS connection pool cannot see the queue I have created, the only way I can see the find the queue in web logic is to make the web logic datasource connection pool use the credentials of the DB user who created the queue.

I have done the following as admin_user:

Created a Queue Table

EXECUTE DBMS_AQADM.CREATE_QUEUE_TABLE(queue_table=>'testqueue_table',queue_payload_type=>'sys.aq$_jms_text_message');

Created a Queue

EXECUTE dbms_aqadm.create_queue(queue_name=>'testqueue', queue_table=>'testqueue_table');

Started the Queue

EXECUTE dbms_aqadm.start_queue(queue_name=>'testqueue');

Granted the CPOOL user permissions

GRANT aq_user_role TO cpool;
EXECUTE DBMS_AQADM.grant_queue_privilege(privilege=>'ALL', queue_name=>'adming_user.testqueue', grantee=>'cpool',grant_option=>FALSE);

Set up 2 JDBC DataSources in Web Logic I set up 2 datasources in web logic which connect to my database, both are identical except that one uses the cpool user and the other uses admin_user

Create JMS Modules Now I register a jms module with the JDBC DataSources and wire up the local and foreign JDNI names.

If I use the DataSource which uses admin_user everything works fine and my deployed application can find queue in JNDI.

Problem If I use the data source which uses cpool then it fails finds the connection pool in JNDI but never the Queue (despite the fact it worked for admin_user). I get the following error from WL:

Related cause:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testqueue': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Cannot resolve name:Queues/TESTQUEUE

Does anyone know why WL cannot resolve the JNDI name for the queue unless I use the admin_user account for my datasource.

Was it helpful?

Solution

The answer was that my connection pool user was missing some grants, the following where required:

GRANT EXECUTE on DBMS_AQ to <CPOOL>;
GRANT EXECUTE on DBMS_AQADM to <CPOOL>;
GRANT aq_user_role to <CPOOL>;

Make sure the user who creates the destination grants access to the connection pool user:

`EXECUTE DBMS_AQADM.grant_queue_privilege(privilege=>'ALL', queue_name=>'<SCHEMAOWNER>.docprod_queue', grantee=>'<CPOOL>',grant_option=>FALSE);`

Finally in Web Logic make sure to reference the destination by their full foreign JNDI name:

Queues/<SCHEMA OWNER>.<DESTINATION_NAME>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top