I have a JAX-WS web service that has been running in a production environment for about two and a half months now and everything seemed to be running perfectly. However, in the last few da开发者_开发技巧ys I have noticed that it appears that requests to the web service from different clients are becoming intermingled at random. When this happens one request that is currently being processed gets interrupted somehow by second request and the second request completes processing before the first request and the response for the second request is sent to both the first and second requester. The web service works exactly as it's supposed to 98.5% of the time and the other 1.5% of the time this problem seems to be showing up.
When this occurs there are no errors written to the Tomcal logs. The web service uses log4j and the log file for the web service also will have no exceptions when this occurs.
Thanks in advance for any help that you may be able to provide.
From the description this sounds like a threading issue.
Just like in servlets where the programmer must make sure that the code is thread safe so you must make sure that the code in your web service is thread safe.
Just like in servlets, a single instance of you web service implementation will be used for all (concurrent) requests so you must make sure that your code is thread safe.
精彩评论