Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Race conditions in EclipseLink runtime?

Hi Laird,

  I have entered the following bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=312253

I have a good idea how to fix this issue and am looking in to how easy it will be to integrate a test case into our framework. If I can do it easily, I will check in the change. If not, I will attach the current state of my work to the bug and a fix will be checked in when it gets to the top of the priority list.

Thanks for all your help in recreating this issue,
-Tom

Laird Nelson wrote:
On Wed, May 5, 2010 at 1:54 PM, Laird Nelson <ljnelson@xxxxxxxxx <mailto:ljnelson@xxxxxxxxx>> wrote:

    On Wed, May 5, 2010 at 1:30 PM, Tom Ware <tom.ware@xxxxxxxxxx
    <mailto:tom.ware@xxxxxxxxxx>> wrote:
     > What are the syptoms of the failure?  Is there an exception?  Are
     > results different?  Is SQL not as expected?

    The symptoms take one of two forms, and there doesn't seem to be rhyme
    or reason about which error I'm likely to see.


[snip]

(The stack for the second symptom is below.)
    The second is that periodically EclipseLink will get confused and try
    to instantiate the abstract root of an entity hierarchy directly when
    a subclass is trying to be inserted.  Specifically, I have an
    AtomicNameEntity class that extends NameEntity.  Both are marked as
    @Entity.  NameEntity, being the root of the hierarchy, defines an
    @Inheritance of type SINGLE_TABLE.  Sometimes EclipseLink, on being
    told to persist an AtomicNameEntity object will throw an
    InstantiationException trying, for some reason, to create a new
    instance of NameEntity.  NameEntity is abstract, as permitted by the
    JPA 2.0 specification; AtomicNameEntity obviously is not.

    Here are the top-level mappings:

    @DiscriminatorColumn(name = "kind", length = 30)
    @Entity(name = "Name")
    @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
    @Table(name = "Name")
    public abstract class NameEntity implements Name {

    And:

    @DiscriminatorValue("AtomicName")
    @Entity(name = "AtomicName")
    public class AtomicNameEntity extends NameEntity {


Here is the stack for the second error:

javax.persistence.PersistenceException: Exception [EclipseLink-34] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.DescriptorException Exception Description: This class does not define a public default constructor, or the constructor raised an exception.
Internal Exception: java.lang.InstantiationException
Descriptor: RelationalDescriptor(com.foobar.party.jpa.NameEntity --> [DatabaseTable(foobar.Name)]) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:699) at com.foobar.party.jpa.TestCasePartyEntity.testInsert(TestCasePartyEntity.java:108)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.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.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:24)
    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.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:165)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:107)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:289) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1005) Caused by: Exception [EclipseLink-34] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.DescriptorException Exception Description: This class does not define a public default constructor, or the constructor raised an exception.
Internal Exception: java.lang.InstantiationException
Descriptor: RelationalDescriptor(com.foobar.party.jpa.NameEntity --> [DatabaseTable(foobar.Name)]) at org.eclipse.persistence.exceptions.DescriptorException.instantiationWhileConstructorInstantiation(DescriptorException.java:724) at org.eclipse.persistence.internal.descriptors.InstantiationPolicy.buildNewInstanceUsingDefaultConstructor(InstantiationPolicy.java:139) at org.eclipse.persistence.internal.descriptors.InstantiationPolicy.buildNewInstance(InstantiationPolicy.java:103) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildNewInstance(ObjectBuilder.java:430) at org.eclipse.persistence.descriptors.copying.InstantiationCopyPolicy.buildClone(InstantiationCopyPolicy.java:31) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildBackupClone(ObjectBuilder.java:363) at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.buildBackupClone(DeferredChangeDetectionPolicy.java:199) at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.revertChanges(DeferredChangeDetectionPolicy.java:263) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.resumeUnitOfWork(UnitOfWorkImpl.java:5183) at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:377) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:696)
    ... 37 more
Caused by: java.lang.InstantiationException
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.eclipse.persistence.internal.descriptors.InstantiationPolicy.buildNewInstanceUsingDefaultConstructor(InstantiationPolicy.java:132)
    ... 46 more
I hope this helps.

Best,
Laird


------------------------------------------------------------------------

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top