Announcement Announcement Module
Collapse
No announcement yet.
Problem with userCache using ehCache. Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with userCache using ehCache.

    I'm in the process of integrating Acegi Security into a project I'm working on, and have come across a strange problem when running unit tests.

    I have implemented my own authorizationDao, and setup a userCache to use the ehCache mechanism.

    When I run the tests that call the authenticationDao.lookupByUsername() method, I get no problems. However, if I run other tests that do not use the lookupByUsername() method of the authenticationDao, I'm getting the following exception being thrown when the spring context(s) are closed:
    Code:
    09:43:07,437 XXX ERROR DefaultListableBeanFactory:1145 - destroy() on bean with name 'userCache' threw an exception
    java.lang.NullPointerException
    	at net.sf.acegisecurity.providers.dao.cache.EhCacheBasedUserCache.destroy(EhCacheBasedUserCache.java:113)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.destroyBean(AbstractAutowireCapableBeanFactory.java:1142)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.destroySingleton(AbstractBeanFactory.java:428)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.destroySingletons(AbstractBeanFactory.java:414)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.destroySingletons(AbstractAutowireCapableBeanFactory.java:1096)
    	at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:420)
    	at com.du.eproc.dao.DAOTestBase.tearDown(DAOTestBase.java:39)
    	at com.du.eproc.dao.OrganisationDAOTest.tearDown(OrganisationDAOTest.java:33)
    Im using ehCache 0.9, although it looks like Acegi uses ehCache 0.7 ? I'm setting the userCache to use the acegi ehCache mechanism in my spring context file:
    Code:
    	<bean
    		id="userCache"
    		class="net.sf.acegisecurity.providers.dao.cache.EhCacheBasedUserCache">
    		<property name="minutesToIdle">
    			<value>5</value>
    		</property>
    	</bean>
    It looks like (and I may be wrong) that if nothing is put in the userCache, then there is a problem when the cache is destroyed.

    Any pointers ?

    Thanks

    Lawrie Nichols

  • #2
    Opps

    Apologies, I've just found the solution elsewhere in this forum (must bone up on my search skills).

    Lawrie

    Comment

    Working...
    X