Community
Participate
Working Groups
Build Identifier: I enabled lazy-loading in my application using static weaving. When static weaving was enabled, I immediately started to see the following stack trace: Caused by: java.lang.IllegalStateException: Can't overwrite cause at java.lang.Throwable.initCause(Throwable.java:320) at org.eclipse.persistence.exceptions.DescriptorException.errorAccessingSetMethodOfEntity(DescriptorException.java:391) at org.eclipse.persistence.internal.indirection.WeavedObjectBasicIndirectionPolicy.getSetMethod(WeavedObjectBasicIndirectionPolicy.java:87) at org.eclipse.persistence.internal.indirection.WeavedObjectBasicIndirectionPolicy.setRealAttributeValueInObject(WeavedObjectBasicIndirectionPolicy.java:131) at org.eclipse.persistence.internal.indirection.WeavedObjectBasicIndirectionPolicy.updateValueInObject(WeavedObjectBasicIndirectionPolicy.java:99) at org.eclipse.persistence.internal.indirection.WeavedObjectBasicIndirectionPolicy.getRealAttributeValueFromObject(WeavedObjectBasicIndirectionPolicy.java:67) at org.eclipse.persistence.mappings.ForeignReferenceMapping.getRealAttributeValueFromAttribute(ForeignReferenceMapping.java:865) at org.eclipse.persistence.mappings.ObjectReferenceMapping.getRealAttributeValueFromAttribute(ObjectReferenceMapping.java:279) at org.eclipse.persistence.mappings.ObjectReferenceMapping.compareForChange(ObjectReferenceMapping.java:152) at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.createObjectChangeSetThroughComparison(DeferredChangeDetectionPolicy.java:165) at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.createObjectChangeSet(DeferredChangeDetectionPolicy.java:137) at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.calculateChanges(DeferredChangeDetectionPolicy.java:89) at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.calculateChangesForExistingObject(DeferredChangeDetectionPolicy.java:54) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.calculateChanges(UnitOfWorkImpl.java:634) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1512) at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:264) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1148) at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:84) The root problem is line 391 in DescriptorException: public static DescriptorException errorAccessingSetMethodOfEntity(Class aClass, String methodName, ClassDescriptor descriptor, Exception underlying) { Object[] args = { aClass, methodName }; DescriptorException exception = new DescriptorException(ExceptionMessageGenerator.buildMessage(DescriptorException.class, INTERNAL_ERROR_SET_METHOD, args), descriptor, underlying); exception.initCause(underlying); // LINE 391: IllegalStateException is thrown here. return exception; } Line 391 is the only place that exception.initCause(...) is called in the entire file. 'initCause' should not be called!!! All other methods in DescriptorException use exception.setErrorCode(...) instead. Also NOTE that because IllegalStateException is thrown, it's impossible to see the original underlying exception. Reproducible: Always
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink