【问题标题】:How do I fix the grails configuration errors when upgrading from 1.3.5 to 1.3.9?从 1.3.5 升级到 1.3.9 时如何修复 grails 配置错误?
【发布时间】:2013-09-27 15:32:27
【问题描述】:

我很难让我的 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

【问题讨论】:

  • 至少升级到 2.0.x 不是更好吗?
  • 我将在不久的将来升级到 2.0,但下载总是失败。目前,我被告知只需升级到 1.3.9,因为这是我们许多其他项目使用的。

标签: hibernate tomcat grails ehcache


【解决方案1】:

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

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

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

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

【讨论】:

  • 感谢您的回复!我刚刚尝试安装该插件,但 cache-ehcache 插件仅与 grails 2.0 或更高版本兼容。我正在使用 1.3.9。我尝试了其他几个,但似乎没有一个有效。我已经看到了其他问题,但无法使用该信息解决我的问题。
猜你喜欢
  • 1970-01-01
  • 2019-09-20
  • 1970-01-01
  • 2019-05-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多