HTTP/1.1 409 Conflict on POST to create a storage area
Can anyone please throw some light on why there may be "HTTP/1.1 409 Conflict" error on a POST request to the JFS storage service to create a new storage area?
The following spec only discusses 409 error in context of PUT/DELETE Can there be platform issue? My code to create a storage area works fine on Windows machines, but it is failing on a Linux box. Any help will be greatly appreciated Thanks |
4 answers
A 409 will be returned by the storage service for POST if a resource with the specified name already exists. If you are creating the storage area as part of servicing a request, then if your service receives more than one request in parallel, it will try to create the storage area more than once. You might need to protect such code against multiple thread execution, and check to make sure the storage area doesn't already exist before trying to create it.
Can anyone please throw some light on why there may be "HTTP/1.1 409 Conflict" error on a POST request to the JFS storage service to create a new storage area? |
I already have the code to create a storage area in a synchronized block. Also,when I check whether such a named resource exists I cannot any such resource. As I mentioned, the problem only occurs on Linux servers. I attach my source code here -- I will glad if you can provide some insight as to what could go wrong here.
I get the following message: Failed to create resource: jfs.cadworkbench.storage. Response Status Line: HTTP/1.1 409 Conflict Thanks for your help Regards Debdoot A 409 will be returned by the storage service for POST if a resource with the specified name already exists. If you are creating the storage area as part of servicing a request, then if your service receives more than one request in parallel, it will try to create the storage area more than once. You might need to protect such code against multiple thread execution, and check to make sure the storage area doesn't already exist before trying to create it. Can anyone please throw some light on why there may be "HTTP/1.1 409 Conflict" error on a POST request to the JFS storage service to create a new storage area? |
Your code looks OK to me, though you didn't post the key parts: the checkResourceExists method and the config.getCADWStorageAreaURL method. If the URL is not being constructed correctly, or the existence of the resource is not being determined correctly, then the code would try to create the storage area repeatedly.
Another comment: if you're calling the createStorageArea method for every incoming request to your service, then you'll be checking for the existence of the storage area on every request, which will be using CPU and network resources unnecessarily. I already have the code to create a storage area in a synchronized block. Also,when I check whether such a named resource exists I cannot any such resource. As I mentioned, the problem only occurs on Linux servers. I attach my source code here -- I will glad if you can provide some insight as to what could go wrong here. |
Thanks a lot for your help. The problem was resolved on cleaning the databases with repotools.
Cheers Debdoot Your code looks OK to me, though you didn't post the key parts: the checkResourceExists method and the config.getCADWStorageAreaURL method. If the URL is not being constructed correctly, or the existence of the resource is not being determined correctly, then the code would try to create the storage area repeatedly. I already have the code to create a storage area in a synchronized block. Also,when I check whether such a named resource exists I cannot any such resource. As I mentioned, the problem only occurs on Linux servers. I attach my source code here -- I will glad if you can provide some insight as to what could go wrong here. |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.