【问题标题】:How to come out of error-org.springframework.beans.factory.BeanCreationException?如何摆脱error-org.springframework.beans.factory.BeanCreationException?
【发布时间】:2011-09-25 16:38:59
【问题描述】:

我在我的 grails 应用程序中使用 spring 安全核心插件。当我运行该应用程序时,出现以下错误。我该如何解决这个问题?

Configuring Spring Security ...
2011-06-30 10:45:19,468 [main] ERROR context.GrailsContextLoader  - Error executing bootstraps: Error creating bean with name 'messageSource': 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.InstantiationException: could not instantiate test objecthospitalmanagement.Physician
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': 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.InstantiationException: could not instantiate test objecthospitalmanagement.Physician
    at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212)
    at grails.web.container.EmbeddableServer$start.call(Unknown Source)
    at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
    at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
    at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
    at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
    at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
    at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
    at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116)
    at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
    at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
    at RunApp$_run_closure1.doCall(RunApp.groovy:33)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:427)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:415)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.executeTargets(Gant.groovy:590)
    at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: 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.InstantiationException: could not instantiate test objecthospitalmanagement.Physician
    ... 23 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.InstantiationException: could not instantiate test objecthospitalmanagement.Physician
    ... 23 more
Caused by: org.hibernate.InstantiationException: could not instantiate test objecthospitalmanagement.Physician
    ... 23 more
Caused by: java.lang.reflect.InvocationTargetException
    ... 23 more
Caused by: groovy.lang.MissingPropertyException: No such property: Patient for class: hospitalmanagement.Physician
    at hospitalmanagement.Physician.<init>(Physician.groovy)
    ... 23 more

【问题讨论】:

    标签: grails spring-security


    【解决方案1】:
    Caused by: groovy.lang.MissingPropertyException: No such property: Patient for class: hospitalmanagement.Physician
        at hospitalmanagement.Physician.<init>(Physician.groovy)
    

    这告诉您hospitalmanagement.Physician 正在尝试访问不存在的Patient 属性(在同一类中)。

    不知道你应该如何解决这个问题,因为你没有显示相应的代码。

    【讨论】:

      【解决方案2】:
      猜你喜欢
      • 2021-04-19
      • 1970-01-01
      • 2015-08-13
      • 2022-11-18
      • 1970-01-01
      • 2014-01-28
      • 2013-10-31
      • 2020-10-19
      • 2019-12-01
      相关资源
      最近更新 更多