Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » StackOverFlow
StackOverFlow [message #755309] Tue, 08 November 2011 03:33 Go to next message
Caio  is currently offline Caio Friend
Messages: 4
Registered: November 2011
Junior Member
Hi for all,

I have started project with EclipseLink... thats great... but, I got stackoverflow with this scenario:
Entities : ClassList, lvlupgain and skilltrees.
ClassList have a column id and it can be referenced for lvlupgain and skilltrees.
ClassList -> lvlupgain (OneToOne)
ClassList -> skilltrees (OneToMany)

RecordCount:
ClassList = 89
lvlupgain = 89
skill_trees = 13722


public void loadData() {
EntityManagerFactory emf;
emf = Persistence.createEntityManagerFactory("TestRelationshipPU");
ClassListJpaController jpa = new ClassListJpaController(emf);
List<ClassList> listData = jpa.findClassListEntities();
for (ClassList classList : listData) {
System.out.println("classList" + classList.getClassName());
}
}


Error:

[EL Info]: 2011-11-08 01:08:30.682--ServerSession(9202071)--EclipseLink, version: Eclipse Persistence Services - 2.2.0.v20110202-r8913
[EL Info]: 2011-11-08 01:08:31.644--ServerSession(9202071)--file:/D:/Projects/TestRelationship/src/_TestRelationshipPU login successful
Exception in thread "main" java.lang.StackOverflowError
at org.eclipse.persistence.internal.sessions.AbstractSession.getDescriptor(AbstractSession.java:2067)
at org.eclipse.persistence.internal.sessions.AbstractSession.getDescriptor(AbstractSession.java:2136)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerExistingObject(UnitOfWorkImpl.java:3816)
at org.eclipse.persistence.mappings.ObjectReferenceMapping.buildUnitofWorkCloneForPartObject(ObjectReferenceMapping.java:96)
at org.eclipse.persistence.mappings.ObjectReferenceMapping.buildCloneForPartObject(ObjectReferenceMapping.java:70)


What cause this error? Thanks so much for your help and NICE Project!!!


Caio
Re: StackOverFlow [message #755566 is a reply to message #755309] Tue, 08 November 2011 19:53 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Hello,

A StackOverflowError occurs when a method recurses too deep and runs out of resources to continue. Unfortunately there is not enough information to determine how this is occuring here - I might assume that your object model is to deep for the opertation that is called. For instance if every object references every other object, EclipseLink's use of recursion to travers the model might cause a stack overflow. If this is the case, remove some of the links in your object model that might be unncessary and/or make some relationships lazy/indirect so that they are not traversed in the process causing the exception.

If this doesn't help you figure out the problem, please provide a bit more of the stack from the exception, and a pared down version of the 3 entities to see how the mappings are defined.
Re: StackOverFlow [message #755568 is a reply to message #755309] Tue, 08 November 2011 19:53 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Hello,

A StackOverflowError occurs when a method recurses too deep and runs out of resources to continue. Unfortunately there is not enough information to determine how this is occuring here - I might assume that your object model is to deep for the opertation that is called. For instance if every object references every other object, EclipseLink's use of recursion to travers the model might cause a stack overflow. If this is the case, remove some of the links in your object model that might be unncessary and/or make some relationships lazy/indirect so that they are not traversed in the process causing the exception.

If this doesn't help you figure out the problem, please provide a bit more of the stack from the exception, and a pared down version of the 3 entities to see how the mappings are defined.
Re: StackOverFlow [message #755771 is a reply to message #755566] Wed, 09 November 2011 14:41 Go to previous messageGo to next message
Caio  is currently offline Caio Friend
Messages: 4
Registered: November 2011
Junior Member
If remove 1 link works... I have insert another link with 89 records and stack again... Bug? I wanna use eclipse... its better Smile

EDIT:
Relationship OneToOne ...

[Updated on: Wed, 09 November 2011 14:51]

Report message to a moderator

Re: StackOverFlow [message #755845 is a reply to message #755771] Wed, 09 November 2011 19:41 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Hello,

I'm not sure what you mean by adding a link with 89 records. Does that mean that there are only 89 instances of the referenced entity, or that 89 instances exist on the object tree being brought in? Depending on your object tree, 89 instances could add multiple layers of recursion when building it. As mentioned, EclipseLink does use recursion when building the object model. So the way around the stack overflow is to reduce the size of your object graph through the use of indirection or removing relationships, or by increasing the size the stack can grow to in your JVM.

Indirection/lazy relationships are described here:http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#What_You_May_Need_to_Know_About_EclipseLink_JPA_Lazy_Loading

The JVM stack size for each thread is generally set using -Xss but you will want to look into appropriate values for your application, as more JVM tuning might be required as well.

Best Regards,
Chris
Previous Topic:lazy loading problem
Next Topic:StackOverFlow
Goto Forum:
  


Current Time: Thu Apr 25 14:46:02 GMT 2024

Powered by FUDForum. Page generated in 0.03128 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top