We have upgraded to CXF 2.6.0 and services started fine but getting following exceptions when first client calls are coming
Exception Cache ws-security.timestamp.cache.instance already exists OR
Cache ws-security.nonce.cache.instance already exists
Our project has multiple webservice endpoints/services in a single JVM and all of the endpoints may get a client SOAP call at the same time. We have WS Security timestamp, signature and encryption enabled. This exception is coming when all the client calls are coming almost at the same time but if the client calls are sparse over time then everything runs fine. But when the exception occurs that particular client received no data or exception.
In our analysis, we found that CXF 2.6.0 is trying to add cache instance for nonce and timestamp through net.sf.ehcache.CacheManager: addCache (final Ehcache cache) API call. I am not sure if this cache instance addition happens for all the SOAP calls or once per endpoint but net.sf.ehcache.CacheManager: addCache (final Ehcache cache) has a strict check, if it is already there (may have been created already by another webservice endpoint in the same JVM) it throws an exception.
It appears that CXF should use net.sf.ehcache.CacheManager: addCacheIfAbsent(final Ehcache cache) instead of net.sf.ehcache.CacheManager: addCache (final Ehcache cache). addCacheIfAbsent(...) does not throw exception if the cache instance is already present.
Currently we have made following changes to avoid the exceptions
<entry key="ws-security.enable.nonce.cache" value="false" />
<entry key="ws-security.enable.timestamp.cache" value="false" />
Please let us know, if this is a bug or are there any other solution such that we do not have to disable nonce and timestamp cache of our own.
|Field||Original Value||New Value|
|Assignee||Colm O hEigeartaigh [ coheigea ]|
|Fix Version/s||2.6.1 [ 12320746 ]|
|Fix Version/s||2.5.4 [ 12320747 ]|
|Fix Version/s||2.4.8 [ 12320748 ]|
|Status||Open [ 1 ]||Resolved [ 5 ]|
|Resolution||Fixed [ 1 ]|
|Status||Resolved [ 5 ]||Closed [ 6 ]|