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

标签 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 和数据库还是很陌生,所以如果我没有正确解释细节,我深表歉意。

谢谢!

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

最佳答案

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

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

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

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

关于hibernate - 从 1.3.5 升级到 1.3.9 时如何修复 grails 配置错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19054656/

相关文章:

jakarta-ee - Tomcat 或 Glassfish 上的 Solr?

html - 文本字段未打印格式化

grails - 更改不在 message.properties 中的 grails "no conversion strategy"错误

hibernate - Grails-使用CreateCriteria执行WHERE IN子查询

java - 使用 HQL 的 Hibernate 分页

Java持久化和Hibernate

java - 在数据库中持久化时不会发生 hibernate 验证

java - 从远程位置动态加载 jar

grails - Grails:如何在日历插件中禁用日期

java - Hibernate:session.get(EntityName.class, Id) 和使用 Criteria 之间的区别