Another error

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Another error

Jonathan Carlson
I renamed my Thread class to MessageThread, and added a Forum class and
now I get this error (the domain classes are below).  I'm using basic
scaffolding and the latest Grails CVS.  Any ideas?  Have a great
weekend!

   [groovy] org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'grailsApplication' defined in
ServletContext resource [/WEB-INF/applicationContext.xml]:
Initialization of bean failed; nested exception is
org.codehaus.groovy.GroovyBugError: BUG exception in phase 'class
generation' in source unit 'ApplicationBootStrap' ClassNode#getTypeClass
for m is called before the type class is set
   [groovy] BUG! exception in phase 'class generation' in source unit
'ApplicationBootStrap' ClassNode#getTypeClass for m is called before the
type class is set
   [groovy]     at
org.codehaus.groovy.ast.ClassNode.getTypeClass(ClassNode.java:939)
   [groovy]     at
org.codehaus.groovy.classgen.BytecodeHelper.getClassInternalName(BytecodeHelper.java:170)
   [groovy]     at
org.codehaus.groovy.classgen.AsmClassGenerator.getStaticFieldName(AsmClassGenerator.java:1723)
   [groovy]     at
org.codehaus.groovy.classgen.AsmClassGenerator.visitClassExpression(AsmClassGenerator.java:2239)
   [groovy]     at
org.codehaus.groovy.ast.expr.ClassExpression.visit(ClassExpression.java:65)
   [groovy]     at
org.codehaus.groovy.classgen.AsmClassGenerator.evaluateEqual(AsmClassGenerator.java:2829)
   [groovy]     at
org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:1058)
   [groovy]     at
org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:79)
   [groovy]     at
org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean(AsmClassGenerator.java:2885)
   [groovy]     at
org.codehaus.groovy.classgen.AsmClassGenerator.visitTupleExpression(AsmClassGenerator.java:2309)
   [groovy]     at
org.codehaus.groovy.ast.expr.TupleExpression.visit(TupleExpression.java:86)
   [groovy]     at
org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:1558)
   [groovy]     at
org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:86)
   [groovy]     at
org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean(AsmClassGenerator.java:2885)
   [groovy]     at
org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:1024)
   [groovy]     at
org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:70)
   [groovy]     at
org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:165)
   [groovy]     at
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:93)
   [groovy]     at
org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:466)
   [groovy]     at
org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:82)
   [groovy]     at
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:41)
   [groovy]     at
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:46)
   [groovy]     at
org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:394)
   [groovy]     at
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:54)

class Forum {
  @Property Long id;
  @Property Long version;
 
  @Property relatesToMany = [messageThreads : MessageThreads.class];
 
  @Property String name;
  @Property Set messageThreads = new HashSet();
}

class MessageThread {
  @Property Long id
  @Property Long version
 
  @Property belongsTo = Forum.class
  Map relatesToMany = [messages : Message.class]
  //@Property relationships = ["messages" : Message.class]
 
  @Property Forum forum
  @Property String title
  @Property Set messages = new HashSet()
}

class Message {
  @Property Long id
  @Property Long version
 
  @Property belongsTo = MessageThread.class

  @Property MessageThread thread
  @Property String userName
  @Property Date date
  @Property String body
 
  @Property constraints = {
    userName(blank:false, length:1..30)
    date()
    body(widget:'textarea', length:0..1000)
  }

}

______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Katun Corporation -- www.katun.com
_____________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Another error

graemer
Jonathan,

The error is because you a referring to a class called
'MessageThreads.class' (note the 's' on the end) which doesn't exist
in the relatesToMany property of the class 'Forum'. Correcting this
fixes the problem for me.

The error message isn't very good though and should probably be raised
as an issue on the Groovy JIRA or reported to the Groovy list

Graeme

On 3/17/06, Jonathan Carlson <[hidden email]> wrote:

> I renamed my Thread class to MessageThread, and added a Forum class and
> now I get this error (the domain classes are below).  I'm using basic
> scaffolding and the latest Grails CVS.  Any ideas?  Have a great
> weekend!
>
>    [groovy] org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name 'grailsApplication' defined in
> ServletContext resource [/WEB-INF/applicationContext.xml]:
> Initialization of bean failed; nested exception is
> org.codehaus.groovy.GroovyBugError: BUG exception in phase 'class
> generation' in source unit 'ApplicationBootStrap' ClassNode#getTypeClass
> for m is called before the type class is set
>    [groovy] BUG! exception in phase 'class generation' in source unit
> 'ApplicationBootStrap' ClassNode#getTypeClass for m is called before the
> type class is set
>    [groovy]     at
> org.codehaus.groovy.ast.ClassNode.getTypeClass(ClassNode.java:939)
>    [groovy]     at
> org.codehaus.groovy.classgen.BytecodeHelper.getClassInternalName(BytecodeHelper.java:170)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.getStaticFieldName(AsmClassGenerator.java:1723)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitClassExpression(AsmClassGenerator.java:2239)
>    [groovy]     at
> org.codehaus.groovy.ast.expr.ClassExpression.visit(ClassExpression.java:65)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.evaluateEqual(AsmClassGenerator.java:2829)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:1058)
>    [groovy]     at
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:79)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean(AsmClassGenerator.java:2885)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitTupleExpression(AsmClassGenerator.java:2309)
>    [groovy]     at
> org.codehaus.groovy.ast.expr.TupleExpression.visit(TupleExpression.java:86)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:1558)
>    [groovy]     at
> org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:86)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean(AsmClassGenerator.java:2885)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:1024)
>    [groovy]     at
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:70)
>    [groovy]     at
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:165)
>    [groovy]     at
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:93)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:466)
>    [groovy]     at
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:82)
>    [groovy]     at
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:41)
>    [groovy]     at
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:46)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:394)
>    [groovy]     at
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:54)
>
> class Forum {
>   @Property Long id;
>   @Property Long version;
>
>   @Property relatesToMany = [messageThreads : MessageThreads.class];
>
>   @Property String name;
>   @Property Set messageThreads = new HashSet();
> }
>
> class MessageThread {
>   @Property Long id
>   @Property Long version
>
>   @Property belongsTo = Forum.class
>   Map relatesToMany = [messages : Message.class]
>   //@Property relationships = ["messages" : Message.class]
>
>   @Property Forum forum
>   @Property String title
>   @Property Set messages = new HashSet()
> }
>
> class Message {
>   @Property Long id
>   @Property Long version
>
>   @Property belongsTo = MessageThread.class
>
>   @Property MessageThread thread
>   @Property String userName
>   @Property Date date
>   @Property String body
>
>   @Property constraints = {
>     userName(blank:false, length:1..30)
>     date()
>     body(widget:'textarea', length:0..1000)
>   }
>
> }
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> Katun Corporation -- www.katun.com
> _____________________________________________________________________
>
Reply | Threaded
Open this post in threaded view
|

RE: Another error

Dierk König
In reply to this post by Jonathan Carlson
Hi,

we had this error before but I currently cannot remember the
reason (old Groovy version?)

Anyway, a few observations about your code below:

- '.class' is not needed, 'Forum' already references the class
- all references to domain classes need to be intitialized, e.g.
  @Property Forum forum = new Forum()
- this may also solve the strange Map/@Property thing.

cheers
Mittie

> -----Original Message-----
> From: Jonathan Carlson [mailto:[hidden email]]
> Sent: Freitag, 17. Marz 2006 23:29
> To: [hidden email]
> Subject: [grails-user] Another error
>
>
> I renamed my Thread class to MessageThread, and added a Forum class and
> now I get this error (the domain classes are below).  I'm using basic
> scaffolding and the latest Grails CVS.  Any ideas?  Have a great
> weekend!
>
>    [groovy] org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name 'grailsApplication' defined in
> ServletContext resource [/WEB-INF/applicationContext.xml]:
> Initialization of bean failed; nested exception is
> org.codehaus.groovy.GroovyBugError: BUG exception in phase 'class
> generation' in source unit 'ApplicationBootStrap' ClassNode#getTypeClass
> for m is called before the type class is set
>    [groovy] BUG! exception in phase 'class generation' in source unit
> 'ApplicationBootStrap' ClassNode#getTypeClass for m is called before the
> type class is set
>    [groovy]     at
> org.codehaus.groovy.ast.ClassNode.getTypeClass(ClassNode.java:939)
>    [groovy]     at
> org.codehaus.groovy.classgen.BytecodeHelper.getClassInternalName(B
> ytecodeHelper.java:170)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.getStaticFieldName(
> AsmClassGenerator.java:1723)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitClassExpressio
> n(AsmClassGenerator.java:2239)
>    [groovy]     at
> org.codehaus.groovy.ast.expr.ClassExpression.visit(ClassExpression
> .java:65)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.evaluateEqual(AsmCl
> assGenerator.java:2829)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpressi
> on(AsmClassGenerator.java:1058)
>    [groovy]     at
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpressi
> on.java:79)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBool
> ean(AsmClassGenerator.java:2885)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitTupleExpressio
> n(AsmClassGenerator.java:2309)
>    [groovy]     at
> org.codehaus.groovy.ast.expr.TupleExpression.visit(TupleExpression
> .java:86)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpr
> ession(AsmClassGenerator.java:1558)
>    [groovy]     at
> org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCall
> Expression.java:86)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBool
> ean(AsmClassGenerator.java:2885)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStat
> ement(AsmClassGenerator.java:1024)
>    [groovy]     at
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionS
> tatement.java:70)
>    [groovy]     at
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(Cod
> eVisitorSupport.java:165)
>    [groovy]     at
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatemen
> t(ClassCodeVisitorSupport.java:93)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement
> (AsmClassGenerator.java:466)
>    [groovy]     at
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:82)
>    [groovy]     at
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeCont
> ainer(ClassCodeVisitorSupport.java:41)
>    [groovy]     at
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOr
> Method(ClassCodeVisitorSupport.java:46)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrM
> ethod(AsmClassGenerator.java:394)
>    [groovy]     at
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassC
> odeVisitorSupport.java:54)
>
> class Forum {
>   @Property Long id;
>   @Property Long version;
>  
>   @Property relatesToMany = [messageThreads : MessageThreads.class];
>  
>   @Property String name;
>   @Property Set messageThreads = new HashSet();
> }
>
> class MessageThread {
>   @Property Long id
>   @Property Long version
>  
>   @Property belongsTo = Forum.class
>   Map relatesToMany = [messages : Message.class]
>   //@Property relationships = ["messages" : Message.class]
>  
>   @Property Forum forum
>   @Property String title
>   @Property Set messages = new HashSet()
> }
>
> class Message {
>   @Property Long id
>   @Property Long version
>  
>   @Property belongsTo = MessageThread.class
>
>   @Property MessageThread thread
>   @Property String userName
>   @Property Date date
>   @Property String body
>  
>   @Property constraints = {
>     userName(blank:false, length:1..30)
>     date()
>     body(widget:'textarea', length:0..1000)
>   }
>
> }
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> Katun Corporation -- www.katun.com
> _____________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

RE: Another error

Jonathan Carlson
In reply to this post by Jonathan Carlson
Thank you much, Graeme and Dirk, for the assistance,

I agree, the error message isn't very good.   Is a "BUG!" message a
user bug, or a Grails developer bug?  I'd say that "BUG" shouldn't be
used in user messages unless it's an internal framework bug to be fixed
by a framework developer.

> - all references to domain classes need to be intitialized, e.g.
  @Property Forum forum = new Forum()

This doesn't make sense to me.  What if the reference is supposed to be
null?  Also, the Book class here (http://grails.codehaus.org/GORM)
doesn't initialize the author property:  

class Book {
    @Property Long id
    @Property Long version

    @Property Author author
    @Property String title
}

Thanks again for your help.  I'm pretty excited that quick-and-dirty
apps will AT LAST be created quickly and without undue effort.  I just
couldn't rationalize jumping on the Ruby bandwagon when Groovy
integrates so well with Java.  I'm sure I'll run into more issues like
this, but if it will help Grails get better faster, I'm happy to be the
guinea pig.

I'll go try these changes and report back...

- Jonathan




>>> [hidden email] 2006-03-18 3:52:45 AM >>>
Hi,

we had this error before but I currently cannot remember the
reason (old Groovy version?)

Anyway, a few observations about your code below:

- '.class' is not needed, 'Forum' already references the class
- all references to domain classes need to be intitialized, e.g.
  @Property Forum forum = new Forum()
- this may also solve the strange Map/@Property thing.

cheers
Mittie

> -----Original Message-----
> From: Jonathan Carlson [mailto:[hidden email]]
> Sent: Freitag, 17. Marz 2006 23:29
> To: [hidden email]
> Subject: [grails-user] Another error
>
>
> I renamed my Thread class to MessageThread, and added a Forum class
and
> now I get this error (the domain classes are below).  I'm using
basic
> scaffolding and the latest Grails CVS.  Any ideas?  Have a great
> weekend!
>
>    [groovy] org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name 'grailsApplication' defined in
> ServletContext resource [/WEB-INF/applicationContext.xml]:
> Initialization of bean failed; nested exception is
> org.codehaus.groovy.GroovyBugError: BUG exception in phase 'class
> generation' in source unit 'ApplicationBootStrap'
ClassNode#getTypeClass
> for m is called before the type class is set
>    [groovy] BUG! exception in phase 'class generation' in source
unit
> 'ApplicationBootStrap' ClassNode#getTypeClass for m is called before
the

> type class is set
>    [groovy]     at
> org.codehaus.groovy.ast.ClassNode.getTypeClass(ClassNode.java:939)
>    [groovy]     at
> org.codehaus.groovy.classgen.BytecodeHelper.getClassInternalName(B
> ytecodeHelper.java:170)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.getStaticFieldName(
> AsmClassGenerator.java:1723)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitClassExpressio
> n(AsmClassGenerator.java:2239)
>    [groovy]     at
> org.codehaus.groovy.ast.expr.ClassExpression.visit(ClassExpression
> .java:65)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.evaluateEqual(AsmCl
> assGenerator.java:2829)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpressi
> on(AsmClassGenerator.java:1058)
>    [groovy]     at
> org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpressi
> on.java:79)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBool
> ean(AsmClassGenerator.java:2885)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitTupleExpressio
> n(AsmClassGenerator.java:2309)
>    [groovy]     at
> org.codehaus.groovy.ast.expr.TupleExpression.visit(TupleExpression
> .java:86)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpr
> ession(AsmClassGenerator.java:1558)
>    [groovy]     at
> org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCall
> Expression.java:86)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBool
> ean(AsmClassGenerator.java:2885)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStat
> ement(AsmClassGenerator.java:1024)
>    [groovy]     at
> org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionS
> tatement.java:70)
>    [groovy]     at
> org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(Cod
> eVisitorSupport.java:165)
>    [groovy]     at
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatemen
> t(ClassCodeVisitorSupport.java:93)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement
> (AsmClassGenerator.java:466)
>    [groovy]     at
>
org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:82)

>    [groovy]     at
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeCont
> ainer(ClassCodeVisitorSupport.java:41)
>    [groovy]     at
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOr
> Method(ClassCodeVisitorSupport.java:46)
>    [groovy]     at
> org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrM
> ethod(AsmClassGenerator.java:394)
>    [groovy]     at
> org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassC
> odeVisitorSupport.java:54)
>
> class Forum {
>   @Property Long id;
>   @Property Long version;
>  
>   @Property relatesToMany = [messageThreads : MessageThreads.class];
>  
>   @Property String name;
>   @Property Set messageThreads = new HashSet();
> }
>
> class MessageThread {
>   @Property Long id
>   @Property Long version
>  
>   @Property belongsTo = Forum.class
>   Map relatesToMany = [messages : Message.class]
>   //@Property relationships = ["messages" : Message.class]
>  
>   @Property Forum forum
>   @Property String title
>   @Property Set messages = new HashSet()
> }
>
> class Message {
>   @Property Long id
>   @Property Long version
>  
>   @Property belongsTo = MessageThread.class
>
>   @Property MessageThread thread
>   @Property String userName
>   @Property Date date
>   @Property String body
>  
>   @Property constraints = {
>     userName(blank:false, length:1..30)
>     date()
>     body(widget:'textarea', length:0..1000)
>   }
>
> }
>
>
______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please
notify
> the system manager.
>
> Katun Corporation -- www.katun.com
>
_____________________________________________________________________

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Katun Corporation -- www.katun.com
_____________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Another error

graemer
On 3/20/06, Jonathan Carlson <[hidden email]> wrote:
> Thank you much, Graeme and Dirk, for the assistance,
>
> I agree, the error message isn't very good.   Is a "BUG!" message a
> user bug, or a Grails developer bug?  I'd say that "BUG" shouldn't be
> used in user messages unless it's an internal framework bug to be fixed
> by a framework developer.
Its not a Grails issue, its a message from Groovy, which is why I
mentioned reporting it to the groovy list.

>
> > - all references to domain classes need to be intitialized, e.g.
>   @Property Forum forum = new Forum()
>
> This doesn't make sense to me.  What if the reference is supposed to be
> null?  Also, the Book class here (http://grails.codehaus.org/GORM)
> doesn't initialize the author property:
>
> class Book {
>     @Property Long id
>     @Property Long version
>
>     @Property Author author
>     @Property String title
> }

Yes the book example should be updated, basically what is happening is
that you are trying to bind values (convert values from strings and
set the property on to it) onto the forum property when it is null. So
there are 2 options (and a future 3rd):

a) intiialise forum before hand
b) update the controller action to manage this relationship
c) we are looking at doing a static factory method for domain classes
that is called automatically
>
> Thanks again for your help.  I'm pretty excited that quick-and-dirty
> apps will AT LAST be created quickly and without undue effort.  I just
> couldn't rationalize jumping on the Ruby bandwagon when Groovy
> integrates so well with Java.  I'm sure I'll run into more issues like
> this, but if it will help Grails get better faster, I'm happy to be the
> guinea pig.

Excellent.. keep us up-to-date on progress :-)

Graeme

>
> I'll go try these changes and report back...
>
> - Jonathan
>
>
>
>
> >>> [hidden email] 2006-03-18 3:52:45 AM >>>
> Hi,
>
> we had this error before but I currently cannot remember the
> reason (old Groovy version?)
>
> Anyway, a few observations about your code below:
>
> - '.class' is not needed, 'Forum' already references the class
> - all references to domain classes need to be intitialized, e.g.
>   @Property Forum forum = new Forum()
> - this may also solve the strange Map/@Property thing.
>
> cheers
> Mittie
>
> > -----Original Message-----
> > From: Jonathan Carlson [mailto:[hidden email]]
> > Sent: Freitag, 17. Marz 2006 23:29
> > To: [hidden email]
> > Subject: [grails-user] Another error
> >
> >
> > I renamed my Thread class to MessageThread, and added a Forum class
> and
> > now I get this error (the domain classes are below).  I'm using
> basic
> > scaffolding and the latest Grails CVS.  Any ideas?  Have a great
> > weekend!
> >
> >    [groovy] org.springframework.beans.factory.BeanCreationException:
> > Error creating bean with name 'grailsApplication' defined in
> > ServletContext resource [/WEB-INF/applicationContext.xml]:
> > Initialization of bean failed; nested exception is
> > org.codehaus.groovy.GroovyBugError: BUG exception in phase 'class
> > generation' in source unit 'ApplicationBootStrap'
> ClassNode#getTypeClass
> > for m is called before the type class is set
> >    [groovy] BUG! exception in phase 'class generation' in source
> unit
> > 'ApplicationBootStrap' ClassNode#getTypeClass for m is called before
> the
> > type class is set
> >    [groovy]     at
> > org.codehaus.groovy.ast.ClassNode.getTypeClass(ClassNode.java:939)
> >    [groovy]     at
> > org.codehaus.groovy.classgen.BytecodeHelper.getClassInternalName(B
> > ytecodeHelper.java:170)
> >    [groovy]     at
> > org.codehaus.groovy.classgen.AsmClassGenerator.getStaticFieldName(
> > AsmClassGenerator.java:1723)
> >    [groovy]     at
> > org.codehaus.groovy.classgen.AsmClassGenerator.visitClassExpressio
> > n(AsmClassGenerator.java:2239)
> >    [groovy]     at
> > org.codehaus.groovy.ast.expr.ClassExpression.visit(ClassExpression
> > .java:65)
> >    [groovy]     at
> > org.codehaus.groovy.classgen.AsmClassGenerator.evaluateEqual(AsmCl
> > assGenerator.java:2829)
> >    [groovy]     at
> > org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpressi
> > on(AsmClassGenerator.java:1058)
> >    [groovy]     at
> > org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpressi
> > on.java:79)
> >    [groovy]     at
> > org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBool
> > ean(AsmClassGenerator.java:2885)
> >    [groovy]     at
> > org.codehaus.groovy.classgen.AsmClassGenerator.visitTupleExpressio
> > n(AsmClassGenerator.java:2309)
> >    [groovy]     at
> > org.codehaus.groovy.ast.expr.TupleExpression.visit(TupleExpression
> > .java:86)
> >    [groovy]     at
> > org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpr
> > ession(AsmClassGenerator.java:1558)
> >    [groovy]     at
> > org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCall
> > Expression.java:86)
> >    [groovy]     at
> > org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBool
> > ean(AsmClassGenerator.java:2885)
> >    [groovy]     at
> > org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStat
> > ement(AsmClassGenerator.java:1024)
> >    [groovy]     at
> > org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionS
> > tatement.java:70)
> >    [groovy]     at
> > org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(Cod
> > eVisitorSupport.java:165)
> >    [groovy]     at
> > org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatemen
> > t(ClassCodeVisitorSupport.java:93)
> >    [groovy]     at
> > org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement
> > (AsmClassGenerator.java:466)
> >    [groovy]     at
> >
> org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:82)
> >    [groovy]     at
> > org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeCont
> > ainer(ClassCodeVisitorSupport.java:41)
> >    [groovy]     at
> > org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOr
> > Method(ClassCodeVisitorSupport.java:46)
> >    [groovy]     at
> > org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrM
> > ethod(AsmClassGenerator.java:394)
> >    [groovy]     at
> > org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassC
> > odeVisitorSupport.java:54)
> >
> > class Forum {
> >   @Property Long id;
> >   @Property Long version;
> >
> >   @Property relatesToMany = [messageThreads : MessageThreads.class];
> >
> >   @Property String name;
> >   @Property Set messageThreads = new HashSet();
> > }
> >
> > class MessageThread {
> >   @Property Long id
> >   @Property Long version
> >
> >   @Property belongsTo = Forum.class
> >   Map relatesToMany = [messages : Message.class]
> >   //@Property relationships = ["messages" : Message.class]
> >
> >   @Property Forum forum
> >   @Property String title
> >   @Property Set messages = new HashSet()
> > }
> >
> > class Message {
> >   @Property Long id
> >   @Property Long version
> >
> >   @Property belongsTo = MessageThread.class
> >
> >   @Property MessageThread thread
> >   @Property String userName
> >   @Property Date date
> >   @Property String body
> >
> >   @Property constraints = {
> >     userName(blank:false, length:1..30)
> >     date()
> >     body(widget:'textarea', length:0..1000)
> >   }
> >
> > }
> >
> >
> ______________________________________________________________________
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom they
> > are addressed. If you have received this email in error please
> notify
> > the system manager.
> >
> > Katun Corporation -- www.katun.com
> >
> _____________________________________________________________________
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> Katun Corporation -- www.katun.com
> _____________________________________________________________________
>
Reply | Threaded
Open this post in threaded view
|

Re: Another error

Jochen Theodorou
Graeme Rocher schrieb:
> On 3/20/06, Jonathan Carlson <[hidden email]> wrote:
>> Thank you much, Graeme and Dirk, for the assistance,
>>
>> I agree, the error message isn't very good.   Is a "BUG!" message a
>> user bug, or a Grails developer bug?  I'd say that "BUG" shouldn't be
>> used in user messages unless it's an internal framework bug to be fixed
>> by a framework developer.
 >
> Its not a Grails issue, its a message from Groovy, which is why I
> mentioned reporting it to the groovy list.


as said, it is a error message from groovy. I added this message and it
is no wonder that someone that is not involved with the groovy internals
doesn't know what this message means. Basically it means that the
resolving step during compilation has a bug, but it is very difficult to
make the error message better or more precise. The bug detection for
this is not at the same place as the bug production, in fact it is even
a different phase.

The message says that a class couldn't be resolved which had been
resolved and is marked as such somewhere. I don't think there is a
possibility to find the exact reason for this without a complete test
program and some debugging

bye blackdrag
Reply | Threaded
Open this post in threaded view
|

RE: Another error

Dierk König
but maybe we could change the message to something like
"Groovy Internal Error: please send a report and donation to ...."

;-)
Mittie

> -----Original Message-----
> From: Jochen Theodorou [mailto:[hidden email]]
> Sent: Dienstag, 21. März 2006 13:28
> To: [hidden email]
> Subject: Re: [grails-user] Another error
>
>
> Graeme Rocher schrieb:
> > On 3/20/06, Jonathan Carlson <[hidden email]> wrote:
> >> Thank you much, Graeme and Dirk, for the assistance,
> >>
> >> I agree, the error message isn't very good.   Is a "BUG!" message a
> >> user bug, or a Grails developer bug?  I'd say that "BUG" shouldn't be
> >> used in user messages unless it's an internal framework bug to be fixed
> >> by a framework developer.
>  >
> > Its not a Grails issue, its a message from Groovy, which is why I
> > mentioned reporting it to the groovy list.
>
>
> as said, it is a error message from groovy. I added this message and it
> is no wonder that someone that is not involved with the groovy internals
> doesn't know what this message means. Basically it means that the
> resolving step during compilation has a bug, but it is very difficult to
> make the error message better or more precise. The bug detection for
> this is not at the same place as the bug production, in fact it is even
> a different phase.
>
> The message says that a class couldn't be resolved which had been
> resolved and is marked as such somewhere. I don't think there is a
> possibility to find the exact reason for this without a complete test
> program and some debugging
>
> bye blackdrag

Reply | Threaded
Open this post in threaded view
|

Re: Another error

graemer
In reply to this post by Jochen Theodorou
On 3/21/06, Jochen Theodorou <[hidden email]> wrote:

> Graeme Rocher schrieb:
> > On 3/20/06, Jonathan Carlson <[hidden email]> wrote:
> >> Thank you much, Graeme and Dirk, for the assistance,
> >>
> >> I agree, the error message isn't very good.   Is a "BUG!" message a
> >> user bug, or a Grails developer bug?  I'd say that "BUG" shouldn't be
> >> used in user messages unless it's an internal framework bug to be fixed
> >> by a framework developer.
>  >
> > Its not a Grails issue, its a message from Groovy, which is why I
> > mentioned reporting it to the groovy list.
>
>
> as said, it is a error message from groovy. I added this message and it
> is no wonder that someone that is not involved with the groovy internals
> doesn't know what this message means. Basically it means that the
> resolving step during compilation has a bug, but it is very difficult to
> make the error message better or more precise. The bug detection for
> this is not at the same place as the bug production, in fact it is even
> a different phase.
That's cool, I didn't mean it as 'it's groovys fault!' kind of
statement. I just meant that the error message is generated from
groovy code not grails code so hence it is there where the error
messages need to be altered/improved and a issue file if necessary. I
understand the complexities believe me and appreciate how difficult it
is :-)

>
> The message says that a class couldn't be resolved which had been
> resolved and is marked as such somewhere. I don't think there is a
> possibility to find the exact reason for this without a complete test
> program and some debugging
As is the case with most of these kind of messages when they appear I imagine.

Graeme

>
> bye blackdrag
>
Reply | Threaded
Open this post in threaded view
|

Re: Another error

Jochen Theodorou
In reply to this post by Dierk König
Dierk Koenig schrieb:
> but maybe we could change the message to something like
> "Groovy Internal Error: please send a report and donation to ...."

ehm, right ;) I can do this easily... I will make that change to this
special error today somewhen.

bye blackdrag