Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
Need help setting up cacheable annotation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help setting up cacheable annotation

    Everything seems to be ok, but nothing gets cached. I have followed the other threads that have discussed this to no avail. there has got to be something I am missing.

    Here is my configuration:

    <ehcache:config configLocation="classpath:/ehcache.xml" serializableFactory="XSTREAM" />

    <ehcache:annotations>
    <ehcache:caching id="licenseAssetCacheModel" cacheName="licenseAssetCache"/>
    <ehcache:flushing id="licenseAssetFlushModel" cacheNames="licenseAssetCache"/>
    </ehcache:annotations>

    I have this dependency setup in my pom.xml

    <dependency>
    <groupId>org.springmodules</groupId>
    <artifactId>spring-modules-cache</artifactId>
    <version>0.9</version>
    </dependency>
    <dependency>
    <groupId>net.sf.ehcache</groupId>
    <artifactId>ehcache</artifactId>
    <version>1.5.0</version>
    </dependency>

    Everything seems fine at startup:

    Oct 06 2008 18:13:48 PM INFO (o.s.c.e.EhCacheManagerFactoryBean) - Initializing EHCache CacheManager
    Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationFactory) - Configuring ehcache from InputStream
    Oct 06 2008 18:13:48 PM DEBUG (net.sf.ehcache.CacheManager) - No disk store path defined. Skipping disk store path conflict test.
    Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CacheManagerEventListenerFactory class specified. Skipping...
    Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CachePeerListenerFactoryConfiguration specified. Not configuring a CacheManagerPeerListener.
    Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CachePeerProviderFactoryConfiguration specified. Not configuring a CacheManagerPeerProvider.
    Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.DiskStoreConfiguration) - Disk Store Path: /opt/software/apache-tomcat-6.0.18/temp
    Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No BootstrapCacheLoaderFactory class specified. Skipping...
    Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CacheLoaderFactory class specified. Skipping...
    Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CacheExceptionHandlerFactory class specified. Skipping...
    Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.DiskStoreConfiguration) - Disk Store Path: /opt/software/apache-tomcat-6.0.18/temp
    Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No BootstrapCacheLoaderFactory class specified. Skipping...
    Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CacheLoaderFactory class specified. Skipping...
    Oct 06 2008 18:13:48 PM DEBUG (n.s.e.config.ConfigurationHelper) - No CacheExceptionHandlerFactory class specified. Skipping...
    Oct 06 2008 18:13:48 PM DEBUG (net.sf.ehcache.store.MemoryStore) - Initialized net.sf.ehcache.store.LfuMemoryStore for licenseAssetCache
    Oct 06 2008 18:13:48 PM DEBUG (net.sf.ehcache.Cache) - Initialised cache: licenseAssetCache

    I have annotated the interface as such:

    Cacheable(modelId = "licenseAssetCacheModel")
    LicenseAsset getLicenseAsset(Long assetId);


    Then, nothing. no caching. what gives.

    anybody. thanks.

    -zach

  • #2
    check out previous postings...

    try to remember using
    Code:
     code tags..
    for posting code...

    within Spring-Modules search for RShelley post with the title "Declarative Caching" (I can't post links yet). It has a lot of useful information on setting up.

    tip -> make sure the annotated part is being done in the interfaces, not the implementation classes.
    Last edited by joshr; Oct 8th, 2008, 04:44 PM.

    Comment


    • #3
      Hey josh, thanks for the tips, I read those in the researching my problems. I finally got it working but I'm not proof positive why. The most obvious answer is that I was suffering my jar issues on the classpath. In the process of getting the 0.8a jar working I must of cleared a discrepancy. I then went and put back the 0.9 jar and all was fine.

      Thanks,

      zach

      Comment


      • #4
        Originally posted by zlegein View Post
        Hey josh, thanks for the tips, I read those in the researching my problems. I finally got it working but I'm not proof positive why. The most obvious answer is that I was suffering my jar issues on the classpath. In the process of getting the 0.8a jar working I must of cleared a discrepancy. I then went and put back the 0.9 jar and all was fine.

        Thanks,

        zach

        Hey,

        How did you get it work?

        Comment


        • #5
          If you are trying to use Spring 3.0, there is a new project listed at the end of this thread that uses annotations for caching. I haven't had time to try it out yet, but it might be worth looking into.

          http://forum.springsource.org/showth...t=47953&page=2

          Comment


          • #6
            I have already configured it to load cache file after servlet configuration. Also I am using spring aop 3.0 and with that I was getting "java.lang.ClassNotFoundException: org.springframework.metadata.Attributes" as all are getting on other threads. So I had included spring 2.5.6-jar and after that it is not throwing exception but caching is also not happening.

            Comment

            Working...
            X