Error creating bean with name 'cacheFactory' in JIRA

Juliano Stefano March 31, 2015

Edit by Adrien: Since the question was posted without a body, I took the liberty of filling in the symptoms.


If a plugin needs a cache, the Atlassian documentation advises to import following, which doesn't work:

<component-import key="cacheFactory" interface="com.atlassian.cache.CacheFactory" />

The plugin installation fails with the following messages:

Plugin 'com.[...]' never resolved service '&cacheFactory' with filter '(objectClass=com.atlassian.cache.CacheFactory)'

How to use the cache in JIRA?

3 answers

1 accepted

0 votes
Answer accepted
crf
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 31, 2015

As Nic said, you haven't given us much to work with, but I'll take a wild stab...

For historic reasons, JIRA exports the heavier CacheManager interface instead of the nice, thin CacheFactory.  It really shouldn't do this, because CacheManager has management interfaces that plugins have no business using, like flushing all of the caches, but it's what we did so it's here to stay for the time being.

This may make it harder for the plugin system to resolve it as a CacheFactory, particularly if you are using the atlassian-cache-compat for cross-version compatibility or have made your plugin "transformerless".

  • If you are just trying to use a CacheFactory, try using CacheManager instead to see if that resolves it.
  • If you are trying to use the compatibility library, take a look at https://bitbucket.org/cfuller/atlassian-scheduler-compat-example for an example of using it
  • If it is somebody else's plugin, check that it is listed as compatible with the version of JIRA you are using

 

 

Adrien Ragot 2
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 9, 2016

tick tl;dr: Replace CacheFactory with CacheManager (even though the former has @PublicApi and the latter @Internal, yes)

<component-import key="cacheFactory" interface="com.atlassian.cache.CacheManager" />
0 votes
crf
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 9, 2016

@Adrien Ragot (Play SQL / CYO): "... the Atlassian documentation advises ..."

Could you provide a link to the documentation that you're speaking of?  The only example of that I have been able to find was in the documentation for Stash add-on developers, and it actually works there because they were not burdened with this historical usage and chose to register it in the container properly.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 31, 2015

Might need a bit more detail on this one...

Suggest an answer

Log in or Sign up to answer