0

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

有任何想法吗?我对 grails 和数据库还很陌生,所以如果我没有正确解释细节,我深表歉意。

谢谢!

数据源.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
4

1 回答 1

0

如果你打算在旧版本的 Grails 中使用这个新的缓存提供程序,你需要为它安装插件。

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

然后,您将拥有所有必要的文件/配置 xml。

另外,请参阅这个问题:EHCache default values in a grails 1.3.9 application

于 2013-09-27T16:46:55.063 回答