Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4294

Exception Cache ws-security.timestamp.cache.instance already exists or Cache ws-security.nonce.cache.instance already exists

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.6
    • 2.4.8, 2.5.4, 2.6.1
    • WS-* Components
    • None
    • Unknown

    Description

      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

      <jaxws:endpoint id="....">
      ...
      <jaxws:properties>
      ...
      <entry key="ws-security.enable.nonce.cache" value="false" />
      <entry key="ws-security.enable.timestamp.cache" value="false" />
      </jaxws:properties>
      </jaxws:endpoint>

      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.

      Attachments

        Activity

          People

            coheigea Colm O hEigeartaigh
            dxmanda Debdayal Mandal
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: