Grails

Self-referencing domain class throws nullpointer exception

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Duplicate
  • Affects Version/s: 1.0.2
  • Fix Version/s: 1.0.3
  • Component/s: Persistence
  • Labels:
    None
  • Environment:
    Linux + mysql 5.0.38

Description

Hi,

Simple class CmsPage with a self-reference to a parent.

class CmsPage {
String name
CmsPage parent

static belongsTo = [parent:CmsPage]
// Validations
static constraints = { parent(nullable:true) }

}

When boostrapping the app in development mode - throwing a spring instanciation exception as below...

[4124] context.ContextLoader Context initialization failed
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 java.lang.NullPointerException
at java.security.AccessController.doPrivileged(Native Method)
at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy:68)
at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy)
at Init_groovy$_run_closure6.doCall(Init_groovy:128)
at RunApp_groovy$_run_closure2.doCall(RunApp_groovy:67)
at RunApp_groovy$_run_closure2.doCall(RunApp_groovy)
at RunApp_groovy$_run_closure1.doCall(RunApp_groovy:59)
at RunApp_groovy$_run_closure1.doCall(RunApp_groovy)
at gant.Gant.dispatch(Gant.groovy:271)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:436)
at gant.Gant.processArgs(Gant.groovy:372)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.NullPointerException
at java.security.AccessController.doPrivileged(Native Method)
... 13 more

Issue Links

Activity

Hide
Jeff Brown added a comment -
Show
Jeff Brown added a comment - See GRAILS-2689

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: