Unable to connect to resource view. The resource is already in use

i encountered this error when I call a web service from my thread. For introduction here is what i do.

  1. create a java ws that calls the the Service.doThreadInvoke. Depending on the number of threads passed the called_service will be invoked

// loop thru the number of threads to be processed
for (int i = 0;i < threadCounter;i++) {
ServiceThread st = Service.doThreadInvoke(folder, called_service, pipeline, 0);
idcPipeline.insertAfter(“run_msg”, “completed thread”);
2. called_service . There is a loop inside this called_service to fetch the messages in a MQ to process individually.

When I call the java ws (item1), only 1 thread works while the other thread just gives an exception as per below.
[SIZE=2][COLOR=#000080]Unable to connect to resource <queue_name>. The resource is already being used in a parent transaction.

I am a newbie in webmethods and need toknow how to avoid such issue.
Many thanks.

One alternative is to use the MQ adapter to manage threading and retrieval rather than doing this in Java code. Integration Server is not an app server like WebSphere or WebLogic. You don’t have to write any Java code to interact with MQ and you most likely don’t need to manage message retrieval threads like you’re trying to do.

ServiceThread st = Service.doThreadInvoke(folder, called_service,…
idcPipeline.insertAfter(“run_msg”, “completed thread”);

Just a heads up, when doThreadInvoke returns, the thread is not necessarily “completed.”

Thanks Reamon. Do you have sample program that does the message retrieval? How do I implement it? The original code that I have is something like this.

  1. webservice does a repeat service (loop) and exits only when there is an exception
  2. for each loop, MQ is being accessed.
    It seems that the web service has a hold on that MQ and will only release it after completion of the run.

I do not have a sample program. My previous experience with MQ on IS has used the MQ Adapter and FLOW services–no Java code. The MQ Adapter completely manages threading and message retrieval. You do not need to write code to do this yourself.

You may be using the term “web service” incorrectly. From what you’ve described, I don’t think the service you’re referring to is a web service. It is simply a service.

I do have the existing flow service using the MQ adapter, however i want to use thread by calling the flow service multiple times. From what I read so far I can invoke multiple thread however when applied i got the error.