Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 176367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:51:50+00:00 2026-05-11T13:51:50+00:00

I want to distribute my EhCache via a JMS Topic. This is documented here

  • 0

I want to distribute my EhCache via a JMS Topic. This is documented here on EhCache’s site

I’m using:

  • ehcache-1.6.0-beta3
  • ehcache-jmsreplication-0.3
  • spring-2.5
  • spring-modules-0.9

My Spring config looks like this:

<bean id='cacheManager'       class='org.springframework.cache.ehcache.EhCacheManagerFactoryBean'> </bean>   <bean id='cacheProvider'       class='org.springmodules.cache.provider.ehcache.EhCacheFacade'>   <property name='cacheManager' ref='cacheManager' /> </bean>     <ehcache:proxy id='pocDaoCache' refId='pocDao'>     <ehcache:caching methodName='fetch' cacheName='pocCache' /> </ehcache:proxy> 

And, pre-JMS config, my ehcache.xml looks like this:

 <diskStore path='c:/projects/cache/demo' />    <defaultCache maxElementsInMemory='50' eternal='false'   timeToIdleSeconds='120' timeToLiveSeconds='120' overflowToDisk='true' />    <cache name='pocCache'         maxElementsInMemory='10000'         maxElementsOnDisk='1000'         eternal='false'         overflowToDisk='true'         diskSpoolBufferSizeMB='20'         timeToIdleSeconds='300'         timeToLiveSeconds='600'         memoryStoreEvictionPolicy='LFU'         / > 

And this works fine. So I add my Topic information:

 <cacheManagerPeerProviderFactory              class='net.sf.ehcache.distribution.jms.JMSCacheManagerPeerProviderFactory'              properties='initialContextFactoryName=JmsInitialContextFactory,       userName=myuser,password=mypass,                  providerURL=tcp://jmsdev1-jndi,tcp://jmsdev2-jndi                  topicConnectionFactoryBindingName=TCF-00,                  topicBindingName=MyTopiceName'              propertySeparator=','              /> 

And I get a NullPointer when I get an application context. Here is the stack trace:

   org.springframework.beans.factory.BeanCreationException:   org.springframework.beans.factory.BeanCreationException: Error creating bean  with name 'cacheManager' defined in class path resource [cache-context.xml]:  Invocation of init method failed; nested exception is java.lang.NullPointerException          at org.springframework.beans.factory.support.AbstractAutowireCapableBean  Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336)          at org.springframework.beans.factory.support.AbstractAutowireCapableBean  Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)          at org.springframework.beans.factory.support.AbstractAutowireCapableBean  Factory$1.run(AbstractAutowireCapableBeanFactory.java:409)          at java.security.AccessController.doPrivileged(Native Method)          at org.springframework.beans.factory.support.AbstractAutowireCapableBean  Factory.createBean(AbstractAutowireCapableBeanFactory.java:380)          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb  ject(AbstractBeanFactory.java:264)          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr  y.getSingleton(DefaultSingletonBeanRegistry.java:217)   [snip] 

Any ideas from anyone?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:51:50+00:00Added an answer on May 11, 2026 at 1:51 pm

    The real problem is that Ehcache’s documentation isn’t right — not even close — to how it is really implemented. Through logging and looking through the code in the jmsreplication module, I was able to get it working.

     <cacheManagerPeerProviderFactory         class='net.sf.ehcache.distribution.jms.JMSCacheManagerPeerProviderFactory'         properties='initialContextFactoryName=com.InitialContextFactory;      userName=uname;password=passwd;             replicationTopicConnectionFactoryBindingName=TCF;             replicationTopicBindingName=CACHE;     providerURL=tcp://server1:7222,tcp://server2:7222;     getQueueConnectionFactoryBindingName=QCF;     getQueueBindingName=CACHE_LOAD     '     propertySeparator=';'     /> 

    Another thing that tripped me up was simple, once I realized it — you have to implement your own key generator to ensure that Ehcache saves the objects with the same keys on each JVM. That makes perfect sense, when you think about it.

    Yes, you have to put in the loader queue information into the cacheManagerPeerProviderFactory. That is because, if you start up a process after one has been running, the new process can pre-load the cache from the existing process.

    You configure the loader requester (cacheLoaderFactory) with the exact same settings:

       <cacheLoaderFactory         class='net.sf.ehcache.distribution.jms.JMSCacheLoaderFactory'    properties='initialContextFactoryName=com.InitialContextFactory;      userName=uname;password=passwd;             replicationTopicConnectionFactoryBindingName=TCF;             replicationTopicBindingName=CACHE;     providerURL=tcp://server1:7222,tcp://server2:7222;     getQueueConnectionFactoryBindingName=QCF;     getQueueBindingName=CACHE_LOAD     '     propertySeparator=';'     /> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to distribute my app on OSX (using py2app) and as a Debian
I currently have a distributed cache using EHCache via RMI that works just fine.
Here's the current situation I'm in: I want to distribute a binary app on
I want to distribute my .NET app via ClickOnce but I also need the
I want to distribute my source code and relevant data files using Autotools: ~/foo$
I have a bunch of scripts which I want to refactor into modules. This
I have a MFC application that I want to distribute via USB flash drives.
Hi guys i need some help here i want to distribute 6 strings randomly
I want distribute some links in columns. I use this css: .cols{ float: left;
I am working on a JQuery Mobile app. I want to distribute this app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.