Wednesday, March 30, 2011

How to use Foreign Server to connect to Foreign Queue in soa suite 11g

It took me really a long time to make a working sample for this.I just couldn't recall all the steps which i have performed earlier but ya i have got several kind of errors while testing my process,The common logs that i got were

<bpelFault><faultType>0</faultType><bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'Produce_Message' failed due to: ERRJMS_ERR_CR_QUEUE_PROD. ERRJMS_ERR_CR_QUEUE_PROD. Unable to create Queue producer due to JMSException. Please examine the log file to determine the problem. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary></part><part name="detail"><detail>[JMSExceptions:045101]The destination name passed to createTopic or createQueue "QueueA" is invalid. If the destination name does not contain a "/" character then it must be the name of a distributed destination that is available in the cluster to which the client is attached. If it does contain a "/" character then the string before the "/" must be the name of a JMSServer or a ".". The string after the "/" is the name of a the desired destination. If the "./" version of the string is used then any destination with the given name on the local WLS server will be returned.</detail></part><part name="code"><code>null</code></part></bindingFault></bpelFault>

<bpelFault><faultType>0</faultType><bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'Produce_Message' failed due to: ERRJMS_ERR_CR_QUEUE_PROD. ERRJMS_ERR_CR_QUEUE_PROD. Unable to create Queue producer due to JMSException. Please examine the log file to determine the problem. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary></part><part name="detail"><detail>[JMSExceptions:045103]While trying to find a topic or a queue we could not find the specific JMSServer requested. The linked exception may contain more information about the reason for failure.</detail></part><part name="code"><code>null</code></part></bindingFault></bpelFault>

<bpelFault><faultType>0</faultType><bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'Produce_Message' failed due to: JCA Binding Component connection issue. JCA Binding Component is unable to create an outbound JCA (CCI) connection. AQSample:aqJMS [ Produce_Message_ptt::Produce_Message(body) ] : The JCA Binding Component was unable to establish an outbound JCA CCI connection due to the following issue: javax.resource.spi.IllegalStateException: [Connector:199176]Unable to execute allocateConnection(...) on ConnectionManager. A stale Connection Factory or Connection Handle may be used. The connection pool associated with it has already been destroyed. Try to re-lookup Connection Factory eis/wls/Queue from JNDI and get a new Connection Handle. Please make sure that the JCA connection factory and any dependent connection factories have been configured with a sufficient limit for max connections. Please also make sure that the physical connection to the backend EIS is available and the backend itself is accepting connections. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary></part><part name="detail"><detail>[Connector:199176]Unable to execute allocateConnection(...) on ConnectionManager. A stale Connection Factory or Connection Handle may be used. The connection pool associated with it has already been destroyed. Try to re-lookup Connection Factory eis/wls/Queue from JNDI and get a new Connection Handle.</detail></part><part name="code"><code>null</code></part></bindingFault></bpelFault>

Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'Produce_Message' failed due to: JCA Binding Component connection issue. JCA Binding Component is unable to create an outbound JCA (CCI) connection. AQSample:aqJMS [ Produce_Message_ptt::Produce_Message(body) ] : The JCA Binding Component was unable to establish an outbound JCA CCI connection due to the following issue: BINDING.JCA-12141 ERRJMS_CONN_FAC_NOT_FOUND. ERRJMS_CONN_FAC_NOT_FOUND. Unable to instantiate connection factory. JMS adapter was unable to look up the connection factory jdbc/ConnectionFactoryDomainB neither through JNDI nor instantiate it as a Java class. Please examine the log file to determine the problem. Please make sure that the JCA connection factory and any dependent connection factories have been configured with a sufficient limit for max connections. Please also make sure that the physical connection to the backend EIS is available and the backend itself is accepting connections. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.

The only reason to paste these error message is that i dont want you people to waste that much time which i have wasted so if you are doing a configuration for Foreign Server to connect to remote queue and getting any of the following exception ,what you need to do is just follow the steps as i have mentioned and inform me on any issues.

I am using two domain for this issue

Domain A running on port 7001

Domain B running on port 7777

I have not created any managed server ,My Admin server is working as a soa server.

Configuration that are required are

DomainA

JMS Server,JMS Module,SubDeployment,Connection Factory and Queue

DomainB

JMS Module,Foreign Server,Destinations and Conenction Factories

Further some secutiry settings are also required which we will see later.

Now we will start with our configuration.

1>Log in to domainA admin console

http://localhost:7001/console

Got to services-->Messaging-->JMS Servers and create a new JMS Server pointing it to admin server.




Now Create a JSM Module and also target it to admin server.




now go to the JMS module that you have created and create a sub deployment

This subdepoyment will target to the JMS Server that we have created.



Now create a connection factory and target it to the subdeployment.
Similary create a queue and also target it to the subdeployment as shown below



That is the only configuration needed to be done from DomainA so far
NOw log in to the admin console of DomainB

Create a JMS module


.
Now go inside the module and create a Foreign Server targetting to Admin server.



Now go to the configuration of Foreign Server

in the JNDI donnection url specify the url for domainA

t3://localhost:7001

JNDI Properties credential specify the password for the server.

IN the jndi properties specify

java.naming.security.principal=weblogic

as shown below



Now go to the connection factory tab and create a new conenction factory

Now here you have to take care

Your local JNDI name can be anything but your remote JNDI should be the JNDI

of conenction factory of domainA ,i.e. in the domainA we have created a connection
factory we have to specify the same url in the remote jndi name.

as shown below



Now again go the destination queue and create a Queue

Here also you need to take care that while giving the remote jndi name you have

to specify the jndi of the queue of domainA and local jndi can be anything.

So my configuration for Destination is as below.



Now just restart yourDomain B so that the queue and connection factory of DomainB can bind to the queue and connection factory of DomainA.

Now once you restarted you need to enable global trust between the two domain.

as pointed out in the following forum link

http://forums.oracle.com/forums/thread.jspa?threadID=2188645&tstart=0

So i followed document

http://download.oracle.com/docs/cd/E13222_01/wls/docs100/ConsoleHelp/taskhelp/security/EnableGlobalTrustBetweenDomains.html

and enabled golbal trust in both my domains

Go to the admin page of each server and click on the domain

Now click on security link -->general page and select

cross domain security enabled

Further go to advanced settings and provide the credentials for the weblogic server.Save the changes.



Now go to you deployment -->JMD adapter and create a new outbound connection pool

Provide the local jndi that you have specified in connection factories of domainB in the connectionFactoryLocation and redeploy your JSM Adapter.



So now you are done with the configuration from Server side.

Now you just need to create a simple process to put the data in the foreign queue.

My process will look like this where in i am just taking an input data and inserting it in to the foreign queue.


Now while creating the JMS adapter wizard you will find the Foreign queue in the drop down list as shown below you have to select the same and proceed.

Here you ahve to take care of two things

First select the right queue and in the jndi name provide the jndi name of the connection pool that you have created for connecting to the queue.



Now test your bpel process and you will find that the data is getting stored in your remote domain.

However this is not a perfect JMS patter as the message can be lost if the remote server is switched off.For testing purpose i shutdown the remote server to see if the server picks up the data once the server restart but it doesn't.i got following error in that case when my remote server was shutdown and i tried to inserted data from foreign server.


<bpelFault><faultType>0</faultType><remoteFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'Produce_Message' failed due to: JCA Binding Component connection issue. JCA Binding Component is unable to create an outbound JCA (CCI) connection. AQSample:aqJMS [ Produce_Message_ptt::Produce_Message(body) ] : The JCA Binding Component was unable to establish an outbound JCA CCI connection due to the following issue: BINDING.JCA-12141 ERRJMS_CONN_FAC_NOT_FOUND. ERRJMS_CONN_FAC_NOT_FOUND. Unable to instantiate connection factory. JMS adapter was unable to look up the connection factory jdbc/ConnectionFactoryDomainB neither through JNDI nor instantiate it as a Java class. Please examine the log file to determine the problem. Please make sure that the JCA connection factory and any dependent connection factories have been configured with a sufficient limit for max connections. Please also make sure that the physical connection to the backend EIS is available and the backend itself is accepting connections. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary></part><part name="detail"><detail>Destination unreachable; nested exception is: java.net.ConnectException: Connection refused: connect; No available router to destination</detail></part><part name="code"><code>null</code></part></remoteFault></bpelFault>

So this process has some demerit that the messages are not saved so that when the remote system gets active again the data can be delivered.We can create our own error queue to store those messages which are not delivered.

However i believe this give us a new point to understand the use of Store and Forward concept in weblogic which we will see in the following post.

http://soa-bpel-esb.blogspot.com/2011/04/store-and-forwardsaf-in-soa-suite-11g.html

1 comment:

Gaurav Prasad said...

Thanks for your valuable post but I've a question over this:

Your example is based on 2 different domains (but on same machine i.e localhost) but I've a requirement to access queues present on a different machine i.e 2 different domains on 2 different machines.

I tried all steps you mentioned but In the last after all setup in both servers (including enabling trust),When I try to create a JMS adapter in SOA composite,I'm not able to see My Foeign Queue in the list.I can only see a folder with my Foreign Server name but Queue and Connection Factory I created in that Foreign Server is not being fetched in the list.

Can you Please suggest what I could be missing?