2017-10-13 52 views
0

對於已成功構建的應用程序,我正在使用Grails 2.3.3。事務管理器中的GrailsContextLoader錯誤

我現在結合春季安全到應用程序中添加插件行:我收到有關transactionManagersessionfactory這GrailsContextLoader錯誤

compile ":spring-security-core:2.0-RC5" 

結果 - 以下是錯誤:

Error | 2017-10-13 12:46:09,299 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Association references unmapped class: homevu1.PicturesNWShr Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Association references unmapped class: homevu1.PicturesNWShr

PicturesNWShr是我的一個領域,如果刪除了spring-security插件,就沒有問題了。

我掃描了一篇相關帖子,雖然我還沒有找到一個具有相同問題的帖子。但是一些人建議對項目的根文件夾中的依賴文件進行修改,以強制或排除構建中的依賴關係。

我會歡迎一些建議嗎?

這裏是PicturesNWShr的域定義:

package homevu1 

import java.util.Date; 

class PicturesNWShr { 

    static constraints = { 
     name() 
     filename(blank: true, nullable: true) 
     dateCreated() 
     caption(blank: true, nullable: true) 
     slotType(blank: true, nullable: true) 
     groupName(blank: true, nullable: true) 
    } 

    static mapping = { 
     datasource 'publish' 
    } 

    String name 
    String filename 
    String caption 
    Date dateCreated 
    VideoSlotTypeShr slotType 
    String groupName // link pictures together for multifile upload 
    // ideal for linking al images of a house together for EAs. 
    Date updateDate // The multiple file upload process - checks each instance update is complete 
    // before adding to vidSlot. 
    static belongsTo = [userBT: UserShr] 


    String toString() { 
     "${name}" 
    } 
} 

-Mike

+0

表明我們相關 – injecteer

+0

類@injecteer增加了對PicturesNWShr域文件。 – mikek

+0

使用2.0.0最終版本的插件'org.grails.plugins:spring-security-core:2.0.0' – saw303

回答

0

已經進一步深入探討對此映射錯誤後#1歸檔 - 我已經確定是什麼錯誤。

它有對我的域的兩個獨立的數據來源做,當我伸出UserShr這是PicturesNWShr的外鍵不能映射這是SecUser,SecRole & SecUserSecRole在不同的數據源。

那說我不知道​​如何在此刻像現在我需要「撤消」做我的應用程序是什麼S2-快速入門並確保SecUser,SecRole & SecUserRole被放置在「發佈」數據源解決此如上面的域類定義中所引用的。

需要進一步探索Stackoverflow。

-Mike