commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Cruikshank" <a...@carbonfive.com>
Subject RE: java.lang.StackOverflowError
Date Thu, 02 Sep 2004 16:39:28 GMT
This looks like an infinite recursion caused by a circular reference in
the object you're passing to HashCodeBuilder.reflectionHashCode().
Perhaps you're passing in a HashMap that contains a object that
references the HashMap that contains it, or something like that.  We've
run into this problem before.  Unfortunately, (to the best of my
knowledge) the builder classes can't be told to check for circular
references, so you're options are to eliminate the circular reference,
extend HashCodeBuilder to check for circular references, or to build the
hash code yourself.

Alex

-----Original Message-----
From: White, Joshua A (HTSC, CASD) [mailto:Joshua.White@htsco.com] 
Sent: Thursday, September 02, 2004 9:31 AM
To: 'Jakarta Commons Users List'
Subject: RE: java.lang.StackOverflowError

This problem might be caused by how I have my domain model constructed.
I
have created and abstract class "Value" which all my domain classes
extend
from (Entity extends Value ... etc).  Value has the following methods:

    public String toString() {
        return ToStringBuilder.reflectionToString(this,
                ToStringStyle.MULTI_LINE_STYLE);
    }

    public boolean equals(Object o) {
        return EqualsBuilder.reflectionEquals(this, o);
    }

    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

If I have a domain object with other domain objects as members, will
this
cause the below exception?

Regards,

Joshua



 


-----Original Message-----
From: White, Joshua A (HTSC, CASD) [mailto:Joshua.White@htsco.com]
Sent: Thursday, September 02, 2004 12:14 PM
To: 'commons-user@jakarta.apache.org'
Subject: java.lang.StackOverflowError


All,
 
I am receiving a java.lang.StackOverflowError.  The stack trace is very
repetitive.  Any ideas on how I may debug this?
 
Regards,
 
Joshua
 
 
DEBUG - SessionImpl.finalize(3384) | running Session.finalize()
DEBUG - SessionImpl.finalize(3384) | running Session.finalize()
DEBUG - SessionImpl.finalize(3384) | running Session.finalize()
DEBUG - SessionImpl.finalize(3384) | running Session.finalize()
DEBUG - SessionImpl.finalize(3384) | running Session.finalize()
DEBUG - SessionImpl.finalize(3384) | running Session.finalize()
 
java.lang.StackOverflowError
 at java.lang.reflect.AccessibleObject.<init>(AccessibleObject.java:137)
 at java.lang.reflect.Field.<init>(Field.java:62)
 at java.lang.reflect.Field.copy(Field.java:83)
 at java.lang.reflect.ReflectAccess.copyField(ReflectAccess.java:92)
 at sun.reflect.ReflectionFactory.copyField(ReflectionFactory.java:277)
 at java.lang.Class.copyFields(Class.java:1962)
 at java.lang.Class.getDeclaredFields(Class.java:1090)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionAppend(HashCod
eBui
lder.java:345)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:327)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:194)
 at employeeclub.domain.Value.hashCode(Value.java:22)
 at
org.apache.commons.lang.builder.HashCodeBuilder.append(HashCodeBuilder.j
ava:
392)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionAppend(HashCod
eBui
lder.java:353)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:327)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:194)
 at employeeclub.domain.Value.hashCode(Value.java:22)
 at
org.apache.commons.lang.builder.HashCodeBuilder.append(HashCodeBuilder.j
ava:
392)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionAppend(HashCod
eBui
lder.java:353)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:327)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:194)
 at employeeclub.domain.Value.hashCode(Value.java:22)
 at
org.apache.commons.lang.builder.HashCodeBuilder.append(HashCodeBuilder.j
ava:
392)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionAppend(HashCod
eBui
lder.java:353)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:327)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:194)
 at employeeclub.domain.Value.hashCode(Value.java:22)
 at java.util.AbstractSet.hashCode(AbstractSet.java:103)
 at net.sf.hibernate.collection.Set.hashCode(Set.java:384)
 at
org.apache.commons.lang.builder.HashCodeBuilder.append(HashCodeBuilder.j
ava:
392)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionAppend(HashCod
eBui
lder.java:353)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:327)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:194)
 at employeeclub.domain.Value.hashCode(Value.java:22)
 at
org.apache.commons.lang.builder.HashCodeBuilder.append(HashCodeBuilder.j
ava:
392)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionAppend(HashCod
eBui
lder.java:353)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:327)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:194)
 at employeeclub.domain.Value.hashCode(Value.java:22)
 at
org.apache.commons.lang.builder.HashCodeBuilder.append(HashCodeBuilder.j
ava:
392)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionAppend(HashCod
eBui
lder.java:353)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:327)
 at
org.apache.commons.lang.builder.HashCodeBuilder.reflectionHashCode(HashC
odeB
uilder.java:194)
 at employeeclub.domain.Value.hashCode(Value.java:22)
 at java.util.AbstractSet.hashCode(AbstractSet.java:103)
 at net.sf.hibernate.collection.Set.hashCode(Set.java:384)
....
Last 17 lines repeat another 20+ times...


This communication, including attachments, is for the exclusive use of 
addressee and may contain proprietary, confidential or privileged 
information. If you are not the intended recipient, any use, copying, 
disclosure, dissemination or distribution is strictly prohibited. If 
you are not the intended recipient, please notify the sender 
immediately by return email and delete this communication and destroy
all
copies.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message