|
Michael Watzek made changes - 31/Jan/06 01:41 AM
Hi Michael,
can you please provide a cut down guide on what the first of these problems is? What are you calling exactly ? The stack trace says rollback !? (but what caused that?) On which class ? (Employee ?) and what inheritance does it have ? [I don't want to get into taking patches] What I'm getting at is, can I get a simplified testcase that reproduces it ? ... debugging through a large company model just to find something is time-consuming :-( Can it be cut down to just 3 or 4 classes, and then call pm.deletePersistentAll or something ? Further comment : both of these issues are trying to read the results of queries, before the connection is closed while rolling back). What is the query that was executed just before ? and what is the SQL invoked by JPOX ? (in the JPOX log). This should have a column "XXX as JPOXMETADATA" or a discriminator column. This should define the type of the real object in the datastore, and then JPOX is trying to create an instance of it. Is the SQL correct for the query ? Is the value of this class being returned incorrectly and consequently JPOX tries to create an instance of an abstract class (or rather JDOImplHelper.newInstance is asked to but returns null for the class Employee ... why would it do that ?)
Craig Russell made changes - 04/Feb/06 04:27 AM
Craig Russell made changes - 25/Feb/06 07:41 AM
Hi Andy,
the exceptions above can be reproduced executing the code below in conjunction with mapping 4. The code makes persistent a full time employee and iterates the person extent using subclasses equals true. Note, that the exceptions can be reproduces on a clean database with only one full time employee. The exceptions are thrown from call Iterator.next() in line "collection.iterator().next();". Regards, Michael PersistenceManager pm = getPM(); FullTimeEmployee emp = new FullTimeEmployee(1, "first", "last", "middle", new Date(), new Date(), 1000.0); pm.currentTransaction().begin(); pm.makePersistent(emp); pm.currentTransaction().commit(); pm.currentTransaction().begin(); Extent extent = pm.getExtent(Person.class, true); Query query = pm.newQuery(); query.setClass(Person.class); query.setCandidates(extent); Collection collection = (Collection) query.execute(); collection.iterator().next(); pm.currentTransaction().commit(); Considering the timing, I propose that we not fix this for JDO 2.0.
We should take a look at this for a maintenance release.
Craig Russell made changes - 30/Mar/06 06:36 AM
Changing the teardown strategy is unwise, as a bug in the implementation would make all of the completeness tests fail. Instead of changing the teardown implementation, we should add specific tests for the cases of interest.
Craig Russell made changes - 02/Jun/06 11:56 PM
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1) It fixes the order of teardown classes,
2) It fixes call getExtent with subclasses equals true in method getAllObjects.
Some more comments related to this patch:
After this patch is applied, configuration inheritance4 will fail for both, application identity and datastore identity. The runs for both identity types throw exceptions during tearDown:
- Application identity:
javax.jdo.JDOFatalUserException: Cannot create new instance of class "org.apache.jdo.tck.pc.company.Employee". If this is an abstract class, make sure you dont have a row for that class in the database without a corresponding row in any concrete subclass table. (see below)
- Datastore identity:
java.lang.NullPointerException (see below)
As a consequence, subsequent runs will throw duplicate key exceptions unless you clear schema4 manually.
There are two more issues related to this patch:
1) Running configuration inheritance4 is very slow. On my system, it takes about 6 minutes. Usually, inheritance4 takes less than 1 minute.
2) Memory consumption is increasing, when inheritance4 is run with this patch. The VM size is about 550 MB. Without this patch th VM size is about 30 MB running configuration inheritance4.
For these reasons, we propose that JPOX first fixes the problems above, before the patch is checked in.
doRuntck.jdori:
[java] RUN CompletenessTest.test ERROR
[java] Description: Completeness test with inheritance mapping 4: Person, Employee, and Insurance have inheritance s
trategy new-table. PartTimeEmployee, FullTimeEmployee, MedicalInsurance, and DentalInsurance have inheritance strategy s
uperclass-table.
[java] Time: 082
[java] There was 1 error:
[java] 1) test(org.apache.jdo.tck.mapping.CompletenessTest)javax.jdo.JDOFatalException: Exception during tearDown
[java] at org.apache.jdo.tck.JDO_Test.tearDown(JDO_Test.java:306)
[java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:234)
[java] at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:120)
[java] at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:95)
[java] NestedThrowablesStackTrace:
[java] javax.jdo.JDOFatalUserException: Cannot create new instance of class "org.apache.jdo.tck.pc.company.Employee"
. If this is an abstract class, make sure you dont have a row for that class in the database without a corresponding row
in any concrete subclass table.
[java] at org.jpox.state.StateManagerImpl.<init>(StateManagerImpl.java:420)
[java] at org.jpox.AbstractPersistenceManager.getObjectByAID(AbstractPersistenceManager.java:2326)
[java] at org.jpox.store.query.PersistentIDROF.getObjectByAID(PersistentIDROF.java:211)
[java] at org.jpox.store.query.PersistentIDROF.getObject(PersistentIDROF.java:162)
[java] at org.jpox.store.query.ForwardQueryResult.nextResultSetElement(ForwardQueryResult.java:113)
[java] at org.jpox.store.query.ForwardQueryResult.advanceToEndOfResultSet(ForwardQueryResult.java:103)
[java] at org.jpox.store.query.ForwardQueryResult.closingConnection(ForwardQueryResult.java:164)
[java] at org.jpox.AbstractPersistenceManager.notifyQueriesOfConnectionClose(AbstractPersistenceManager.java:32
41)
[java] at org.jpox.AbstractPersistenceManager.preRollback(AbstractPersistenceManager.java:3253)
[java] at org.jpox.NonmanagedTransaction.rollback(NonmanagedTransaction.java:554)
[java] at org.apache.jdo.tck.JDO_Test.cleanupPM(JDO_Test.java:473)
[java] at org.apache.jdo.tck.JDO_Test.cleanupPM(JDO_Test.java:460)
[java] at org.apache.jdo.tck.JDO_Test.deleteTearDownClasses(JDO_Test.java:402)
[java] at org.apache.jdo.tck.JDO_Test.localTearDown(JDO_Test.java:318)
[java] at org.apache.jdo.tck.JDO_Test.tearDown(JDO_Test.java:287)
[java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:234)
[java] at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:120)
[java] at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:95)
[java] FAILURES!!!
[java] Error summary:
[java] 001 error: javax.jdo.JDOFatalUserException: Cannot create new instance of class "org.apache.jdo.tck.pc.compa
ny.Employee". If this is an abstract class, make sure you dont have a row for that class in the database without a corre
sponding row in any concrete subclass table.
[java] derby-app-inheritance4-junit.txt:
[java] ** Tests run: 001, Time: 082 seconds. Failures: 0, Errors: 1
[java] Excluded tests: [org.apache.jdo.tck.enhancement.FieldAccessModified, org.apache.jdo.tck.enhancement.Implement
sPersistenceCapable]
[java] [ERROR] Java Result: 1
[echo] Finished run with database="derby" identitytype="applicationidentity" mapping="4".
exclude:
doRuntck.jdori:
Overriding previous definition of reference to this.jdori.classpath
[java] RUN CompletenessTest.test ERROR
[java] Description: Completeness test with inheritance mapping 4: Person, Employee, and Insurance have inheritance s
trategy new-table. PartTimeEmployee, FullTimeEmployee, MedicalInsurance, and DentalInsurance have inheritance strategy s
uperclass-table.
[java] Time: 239
[java] There was 1 error:
[java] 1) test(org.apache.jdo.tck.mapping.CompletenessTest)javax.jdo.JDOFatalException: Exception during tearDown
[java] at org.apache.jdo.tck.JDO_Test.tearDown(JDO_Test.java:306)
[java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:234)
[java] at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:120)
[java] at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:95)
[java] NestedThrowablesStackTrace:
[java] java.lang.NullPointerException
[java] at org.jpox.state.StateManagerImpl.replaceFields(StateManagerImpl.java:2886)
[java] at org.jpox.store.query.PersistentIDROF$2.fetchFields(PersistentIDROF.java:243)
[java] at org.jpox.state.StateManagerImpl.loadFieldValues(StateManagerImpl.java:801)
[java] at org.jpox.state.StateManagerImpl.<init>(StateManagerImpl.java:511)
[java] at org.jpox.AbstractPersistenceManager.getObjectById(AbstractPersistenceManager.java:2367)
[java] at org.jpox.store.query.PersistentIDROF.getObjectById(PersistentIDROF.java:238)
[java] at org.jpox.store.query.PersistentIDROF.getObject(PersistentIDROF.java:175)
[java] at org.jpox.store.query.ForwardQueryResult.nextResultSetElement(ForwardQueryResult.java:113)
[java] at org.jpox.store.query.ForwardQueryResult.advanceToEndOfResultSet(ForwardQueryResult.java:103)
[java] at org.jpox.store.query.ForwardQueryResult.closingConnection(ForwardQueryResult.java:164)
[java] at org.jpox.AbstractPersistenceManager.notifyQueriesOfConnectionClose(AbstractPersistenceManager.java:32
41)
[java] at org.jpox.AbstractPersistenceManager.preRollback(AbstractPersistenceManager.java:3253)
[java] at org.jpox.NonmanagedTransaction.rollback(NonmanagedTransaction.java:554)
[java] at org.apache.jdo.tck.JDO_Test.cleanupPM(JDO_Test.java:473)
[java] at org.apache.jdo.tck.JDO_Test.cleanupPM(JDO_Test.java:460)
[java] at org.apache.jdo.tck.JDO_Test.deleteTearDownClasses(JDO_Test.java:402)
[java] at org.apache.jdo.tck.JDO_Test.localTearDown(JDO_Test.java:318)
[java] at org.apache.jdo.tck.JDO_Test.tearDown(JDO_Test.java:287)
[java] at org.apache.jdo.tck.JDO_Test.runBare(JDO_Test.java:234)
[java] at org.apache.jdo.tck.util.BatchTestRunner.start(BatchTestRunner.java:120)
[java] at org.apache.jdo.tck.util.BatchTestRunner.main(BatchTestRunner.java:95)
[java] FAILURES!!!
[java] Error summary:
[java] 001 error: java.lang.NullPointerException
[java] derby-dsid-inheritance4-junit.txt:
[java] ** Tests run: 001, Time: 239 seconds. Failures: 0, Errors: 1
[java] Excluded tests: [org.apache.jdo.tck.enhancement.FieldAccessModified, org.apache.jdo.tck.enhancement.Implement
sPersistenceCapable]
[java] [ERROR] Java Result: 1
[echo] Finished run with database="derby" identitytype="datastoreidentity" mapping="4".
result:
[java] Total tests run: 2. Failures: 0, Errors: 2.
[java] 2 of 2 configurations failed.
[java] See file 'F:\users\brazil\jdo-cmp\jdo\trunk\tck20/target/logs/20060130-154940\TCK-results.txt' for details.
BUILD SUCCESSFUL
Total time: 6 minutes 18 seconds
Finished at: Mon Jan 30 15:55:03 CET 2006