2016-02-03 32 views
0

環境的Grails - 訪問org.hibernate.cfg.Environment中是被禁止的錯誤

Grails 2.4.4 
PostgreSQL 9.4 
JDK 1.7 

我試圖讓Grails Database Reverse Engineer Plugin工作。我經歷了一些錯誤,現在我陷入了這些錯誤。 我是一個新手,不太熟悉hibernate。我能做些什麼來彌補這些錯誤?我試圖添加hibernate.properties文件,但沒有奏效。 (我不確定我是否做得對...)

/Grails_Workspace/dbTest/target/work/plugins/db-reverse-engineer-4.0.0/src/groovy/grails/plugin/reveng/Reenigne.groovy: 92: Access to org.hibernate.cfg.Environment#DRIVER is forbidden @ line 92, column 14. 
     properties[Environment.DRIVER] = driverClass 
.    ^
.  
Access to org.hibernate.cfg.Environment#PASS is forbidden @ line 93, column 14. 
     properties[Environment.PASS] = password 
.    ^
.  
Access to org.hibernate.cfg.Environment#URL is forbidden @ line 94, column 14. 
     properties[Environment.URL] = url 
.    ^
.  
Access to org.hibernate.cfg.Environment#USER is forbidden @ line 95, column 14. 
     properties[Environment.USER] = username 
.    ^
.  
Access to org.hibernate.cfg.Environment#DIALECT is forbidden @ line 97, column 15. 
      properties[Environment.DIALECT] = dialect 
.    ^
.  
Access to org.hibernate.cfg.Environment#DEFAULT_SCHEMA is forbidden @ line 100, column 15. 
      properties[Environment.DEFAULT_SCHEMA] = defaultSchema 
.    ^
.  
Access to org.hibernate.cfg.Environment#DEFAULT_CATALOG is forbidden @ line 103, column 15. 
      properties[Environment.DEFAULT_CATALOG] = defaultCatalog 
       ^

謝謝你的幫助。

編輯

插件模塊

plugins { 
    // plugins for the build system only 
    build ":tomcat:7.0.55" 

    // plugins for the compile step 
    compile ":scaffolding:2.1.2" 
    compile ":asset-pipeline:1.9.9" 
    compile ":postgresql-extensions:4.6.1" 
    compile ":joda-time:1.5" 
    compile ":db-reverse-engineer:4.0.0" 

    // plugins needed at runtime but not for compilation 
    runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18" 
    runtime ":database-migration:1.4.0" 
    runtime ":jquery:1.11.1" 

    // Uncomment these to enable additional asset-pipeline capabilities 
    //compile ":sass-asset-pipeline:1.9.0" 
    //compile ":less-asset-pipeline:1.10.0" 
    //compile ":coffee-asset-pipeline:1.8.0" 
    //compile ":handlebars-asset-pipeline:1.3.0.3" 
} 
+0

你能告訴您'BuildConfig.groovy'的'plugins'塊? –

+0

@Burt Beckwith,我編輯了我的帖子。謝謝。 –

+1

我不確定發生了什麼,對於我來說,使用類似配置的測試應用程序可以正常工作。由於逆向工程插件僅用於生成領域類,但它在編譯或運行時根本不使用,所以應該能夠創建一個單獨的應用程序以供插件使用。從'plugins'和'dependencies'塊中刪除所有可用的或未使用的或可能導致問題的東西(即,除了'hibernate4'和'db-reverse-engineer',加上'postgresql-extensions'只在需要時)做那裏的工作,然後將域類移動到真正的應用程序 –

回答

2

有同樣的問題。我用3.0.0

使用

compile ":db-reverse-engineer:3.0.0" 
remove 
runtime ":db-reverse-engineer:4.0.0"