从1.3.5升级到1.3.9时,如何修复grails配置错误?

时间:2013-09-27 15:32:27

标签: hibernate tomcat grails ehcache

我很难让我的Grails应用程序运行。我被分配从grails 1.3.5到1.3.9更新项目并使一切运行。这个项目很旧,所以有些东西已经过时了。我不得不重新定位并添加一个缺少的webflow插件,并更新数据库连接。问题似乎与DataSource.groovy文件中的cache.provider_class有关。我注释掉了OSCacheProvider,因为我收到一个错误,无法找到它并且得知OSCache不再受支持。然后我用我看到的另一个grails项目中使用的EhCacheProvider替换它。我不确定错误指向的是什么,但我认为它与我在项目中没有看到的ehCache.xml文件有关。

有什么想法吗?我对grails和数据库仍然很新,所以如果我没有正确解释详细信息,我会道歉。

谢谢!

DataSource.groovy中

dataSource {
    pooled = true   
    driverClassName = "oracle.jdbc.driver.OracleDriver"
    username = "**********"
    password = "**********"
    dialect = "org.hibernate.dialect.Oracle9Dialect"
}

hibernate {
    cache.use_second_level_cache=true
    cache.use_query_cache=true
    cache.provider_class='net.sf.ehcache.hibernate.EhCacheProvider'
    //cache.provider_class='com.opensymphony.oscache.hibernate.OSCacheProvider' //Outdated
}
// environment specific settings
environments {
    development {
        dataSource {
            dbCreate = "update" // one of 'create', 'create-drop','update'
            url = "*********************"
        }
    }
    test {
        dataSource {
            dbCreate = "update"
            url = "*********************"
        }
    }
    production {
        dataSource {
            dbCreate = "update"
            url = "*********************"
            username = "********"
            password = "********"
        }
    }
}

控制台错误

 Running Grails application..
    2013-09-26 15:22:45,237 [main] INFO  spring.BeanBuilder - [RuntimeConfiguration] Configuring data source for environment: DEVELOPMENT
    2013-09-26 15:22:45,390 [main] DEBUG spring.BeanBuilder - Configuring controller AdminController
    2013-09-26 15:22:45,396 [main] DEBUG spring.BeanBuilder - Configuring controller EmployeeController
    2013-09-26 15:22:45,396 [main] DEBUG spring.BeanBuilder - Configuring controller RenewalController
    2013-09-26 15:22:48,568 [main] DEBUG ehcache.CacheManager - Configuring ehcache from classpath.
    2013-09-26 15:22:48,571 [main] WARN  config.ConfigurationFactory - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/Users/*********/.ivy2/cache/net.sf.ehcache/ehcache-core/jars/ehcache-core-1.7.1.jar!/ehcache-failsafe.xml
    2013-09-26 15:22:48,572 [main] DEBUG config.ConfigurationFactory  - Configuring ehcache from URL: jar:file:/C:/Users/*********/.ivy2/cache/net.sf.ehcache/ehcache-core/jars/ehcache-core-1.7.1.jar!/ehcache-failsafe.xml
    2013-09-26 15:22:48,577 [main] DEBUG config.ConfigurationFactory  - Configuring ehcache from InputStream
    2013-09-26 15:22:48,590 [main] DEBUG config.BeanHandler  - Ignoring ehcache attribute xmlns:xsi
    2013-09-26 15:22:48,590 [main] DEBUG config.BeanHandler  - Ignoring ehcache attribute xsi:noNamespaceSchemaLocation
    2013-09-26 15:22:48,597 [main] DEBUG config.DiskStoreConfiguration  - Disk Store Path: C:\Users\*********\AppData\Local\Temp\
    2013-09-26 15:22:48,610 [main] DEBUG config.ConfigurationHelper  - No CacheManagerEventListenerFactory class specified. Skipping...
    2013-09-26 15:22:48,624 [main] DEBUG config.ConfigurationHelper  - No BootstrapCacheLoaderFactory class specified. Skipping...
    2013-09-26 15:22:48,624 [main] DEBUG config.ConfigurationHelper  - No CacheExceptionHandlerFactory class specified. Skipping...
    2013-09-26 15:22:49,912 [main] WARN  hibernate.EhCacheProvider  - Could not find a specific ehcache configuration for cache named [org.hibernate.cache.UpdateTimestampsCache]; using defaults.
    2013-09-26 15:22:49,918 [main] DEBUG store.DiskStore  - Deleting data file org.hibernate.cache.UpdateTimestampsCache.data
    2013-09-26 15:22:49,921 [main] DEBUG store.MemoryStore  - Initialized net.sf.ehcache.store.MemoryStore for org.hibernate.cache.UpdateTimestampsCache
    2013-09-26 15:22:49,922 [main] DEBUG ehcache.Cache  - Initialised cache: org.hibernate.cache.UpdateTimestampsCache
    2013-09-26 15:22:49,927 [main] DEBUG hibernate.EhCacheProvider  - started EHCache region: org.hibernate.cache.UpdateTimestampsCache
    2013-09-26 15:22:49,938 [main] WARN  hibernate.EhCacheProvider  - Could not find a specific ehcache configuration for cache named [org.hibernate.cache.StandardQueryCache]; using defaults.
    2013-09-26 15:22:49,944 [main] DEBUG store.DiskStore  - Deleting data file org.hibernate.cache.StandardQueryCache.data
    2013-09-26 15:22:49,954 [main] DEBUG store.MemoryStore  - Initialized net.sf.ehcache.store.MemoryStore for org.hibernate.cache.StandardQueryCache
    2013-09-26 15:22:49,959 [main] DEBUG ehcache.Cache  - Initialised cache: org.hibernate.cache.StandardQueryCache
    2013-09-26 15:22:49,966 [main] DEBUG hibernate.EhCacheProvider  - started EHCache region: org.hibernate.cache.StandardQueryCache
    Server running. Browse to http://localhost:8080/license

1 个答案:

答案 0 :(得分:0)

如果您要将此新缓存提供程序与旧版本的Grails一起使用,则需要为其安装插件。

http://grails.org/plugin/cache-ehcache

然后,你将拥有所有必要的文件/ config xml。

另请参阅此问题:EHCache default values in a grails 1.3.9 application

相关问题