2017-10-13 44 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