Coherence failed to load the factory

Recently I’ve been working on a set of applications which are deployed in their own, separate OC4J instances in a cluster. Many of these applications share data and Coherence is used to provide synchronised data caching between the OC4J instances.
Normally this is straight forward enough, except that when I went to set up another environment I started getting failures at startup.
The logs would show messages like…

getConfigurableCacheFactory “Failed to load the factory”

and

Caused by: (Wrapped: Failed to load the factory) java.lang.reflect.InvocationTargetException
at com.tangosol.util.Base.ensureRuntimeException(Base.java:286)
at com.tangosol.net.CacheFactory.getConfigurableCacheFactory(CacheFactory.java:607)
at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:686)
at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:664)

Coherence generally has nice, helpful, error messages which point you in the right direction to solve the problem. This time however, all we got is a ‘Failed to load the factory’ message which, while accurate, does not give an indication about how to fix things.
After some verification in my local development environment I determined that the above message occurs if the coherence cache config file can not be found in the location specified, or if the config file XML is not well formed. In other words, the factory can not be loaded if the cache config file can not be found or parsed.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s