Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » spring IndexOutOfBoundsException(help...please)
spring IndexOutOfBoundsException [message #499073] Thu, 19 November 2009 12:46 Go to next message
serjann is currently offline serjann
Messages: 2
Registered: July 2009
Junior Member
I am running a Spring application that is updating 10 records into a MySql data base, all on the same table. I am encountering an "IndexOutOfBoundsException" from EclispeLink. I wonder if anybody has seen this before and can give a hint as to wht the problem is.

Here is the stack dump:

org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(J paTransactionManager.java:476)
at org.springframework.transaction.support.AbstractPlatformTran sactionManager.processCommit(AbstractPlatformTransactionMana ger.java:767)
at org.springframework.transaction.support.AbstractPlatformTran sactionManager.commit(AbstractPlatformTransactionManager.jav a:736)
at org.springframework.transaction.interceptor.TransactionAspec tSupport.commitTransactionAfterReturning(TransactionAspectSu pport.java:394)
at org.springframework.transaction.aspectj.AbstractTransactionA spect.ajc$afterReturning$org_springframework_transaction_asp ectj_AbstractTransactionAspect$3$2a73e96c(AbstractTransactio nAspect.aj:78)
at com.hg197.addam.persistence.domain.GroupsDataOnDemand.init(G roupsDataOnDemand.java:57)
at com.hg197.addam.persistence.domain.GroupsDataOnDemand.getRan domGroups(GroupsDataOnDemand.java:30)
at com.hg197.addam.persistence.domain.GroupsIntegrationTest.tes tCountGroupses(GroupsIntegrationTest.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(Refl ectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(Fr ameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate( InvokeMethod.java:20)
at org.springframework.test.context.junit4.statements.RunBefore TestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.ja va:74)
at org.springframework.test.context.junit4.statements.RunAfterT estMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java :82)
at org.springframework.test.context.junit4.statements.SpringRep eat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRun ner.runChild(SpringJUnit4ClassRunner.java:240)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit 4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java: 52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java :191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java: 42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java: 184)
at org.springframework.test.context.junit4.statements.RunBefore TestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java :61)
at org.springframework.test.context.junit4.statements.RunAfterT estClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:7 0)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.springframework.test.context.junit4.SpringJUnit4ClassRun ner.run(SpringJUnit4ClassRunner.java:180)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:197)
Caused by: javax.persistence.RollbackException: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at org.eclipse.persistence.internal.jpa.transaction.EntityTrans actionImpl.commitInternal(EntityTransactionImpl.java:102)
at org.eclipse.persistence.internal.jpa.transaction.EntityTrans actionImpl.commit(EntityTransactionImpl.java:63)
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(J paTransactionManager.java:467)
... 35 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at org.eclipse.persistence.queries.DoesExistQuery.getDoesExistF ield(DoesExistQuery.java:245)
at org.eclipse.persistence.queries.DoesExistQuery.prepare(DoesE xistQuery.java:306)
at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(D atabaseQuery.java:458)
at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(D atabaseQuery.java:424)
at org.eclipse.persistence.queries.DatabaseQuery.execute(Databa seQuery.java:640)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitO fWork(DatabaseQuery.java:583)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.int ernalExecuteQuery(UnitOfWorkImpl.java:2697)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1181)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1165)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuery(AbstractSession.java:1125)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.che ckForUnregisteredExistingObject(UnitOfWorkImpl.java:669)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.dis coverAndPersistUnregisteredNewObjects(UnitOfWorkImpl.java:39 33)
at org.eclipse.persistence.mappings.ObjectReferenceMapping.casc adeDiscoverAndPersistUnregisteredNewObjects(ObjectReferenceM apping.java:715)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.c ascadeDiscoverAndPersistUnregisteredNewObjects(ObjectBuilder .java:1493)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.dis coverAndPersistUnregisteredNewObjects(UnitOfWorkImpl.java:39 45)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUni tOfWork.discoverUnregisteredNewObjects(RepeatableWriteUnitOf Work.java:182)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.cal culateChanges(UnitOfWorkImpl.java:619)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.com mitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1361)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUni tOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java: 160)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.com mitAndResume(UnitOfWorkImpl.java:1038)
at org.eclipse.persistence.internal.jpa.transaction.EntityTrans actionImpl.commitInternal(EntityTransactionImpl.java:84)
... 37 more

thanks,
Ed
Re: spring IndexOutOfBoundsException [message #499270 is a reply to message #499073] Fri, 20 November 2009 11:08 Go to previous messageGo to next message
David M. Karr is currently offline David M. Karr
Messages: 352
Registered: July 2009
Senior Member
How about showing us your code and configuration?

If you could load up the source code for eclipselink and step into the code that throws the exception, you might get a useful clue.
Re: spring IndexOutOfBoundsException [message #499693 is a reply to message #499073] Mon, 23 November 2009 13:23 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The error seems to be occurring because your descriptor does not have a primary key set. As this is required, it seems your mappings are either corrupt, or misconfigured.

It is also getting to the error because you are updating an object that has a reference to another detached object, which you should normally not do.

Perhaps include your mappings/code/config/more info.


James : Wiki : Book : Blog : Twitter
Re: spring IndexOutOfBoundsException [message #499977 is a reply to message #499073] Tue, 24 November 2009 11:02 Go to previous message
serjann is currently offline serjann
Messages: 2
Registered: July 2009
Junior Member
Thanks, everyone, for the responses. I seem to have solved the problem by refactoring the entity object and removing execuatable code to another class.
Previous Topic:Eclipselink is spending an hour releasing write locks
Next Topic:Big Picture
Goto Forum:
  


Current Time: Fri Aug 01 12:02:00 EDT 2014

Powered by FUDForum. Page generated in 0.05028 seconds