Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Joda Time attributes in tests running in Eclipse #41

Closed
paulhoadley opened this issue Aug 21, 2014 · 1 comment
Closed

Comments

@paulhoadley
Copy link

Summary: I've diagnosed the issue here, but I'll open (and close) this ticket so there's a reference to it.

I just started getting some failed unit tests when running in Eclipse. The stack trace points to difficulty loading Joda Time classes:

java.lang.IllegalStateException: adaptorValueType: unable to load class named 'LocalDateTime' for attribute date on entity SummaryLine
    at com.webobjects.eoaccess.EOAttribute.adaptorValueType(EOAttribute.java:2216)
    at com.webobjects.eoaccess.EOAttribute.adaptorValueClass(EOAttribute.java:2254)
    at com.webobjects.eoaccess.EOEntityClassDescription._enforcedKVCNumberClassForKey(EOEntityClassDescription.java:548)
    at er.extensions.eof.ERXEntityClassDescription._enforcedKVCNumberClassForKey(ERXEntityClassDescription.java:1280)
    at com.webobjects.eocontrol.EOGenericRecord._otherStorageBinding(EOGenericRecord.java:146)
    at er.extensions.eof.ERXGenericRecord._otherStorageBinding(ERXGenericRecord.java:234)
    at com.webobjects.foundation.NSKeyValueCoding$_ReflectionKeyBindingCreation._createKeyBindingForKey(NSKeyValueCoding.java:1719)
    at com.webobjects.foundation.NSKeyValueCoding$_ReflectionKeyBindingCreation._createKeyGetBindingForKey(NSKeyValueCoding.java:1742)
    at com.webobjects.eocontrol.EOKeyValueCoding$DefaultImplementation._createStoredKeyGetBindingForKey(EOKeyValueCoding.java:346)
    at com.webobjects.eocontrol.EOCustomObject._createStoredKeyGetBindingForKey(EOCustomObject.java:1740)
    at com.webobjects.eocontrol.EOGenericRecord._storedKeyGetBindingForKey(EOGenericRecord.java:203)
    at com.webobjects.eocontrol.EOCustomObject.storedValueForKey(EOCustomObject.java:1633)
    at com.webobjects.eocontrol.EOCustomObject.snapshot(EOCustomObject.java:515)
    at com.webobjects.eocontrol.EOEditingContext.objectWillChange(EOEditingContext.java:2813)
    at er.extensions.eof.ERXEC.objectWillChange(ERXEC.java:967)
    at com.wounit.rules.MockEditingContext.objectWillChange(MockEditingContext.java:295)
    at com.webobjects.eocontrol.EOObserverCenter.notifyObserversObjectWillChange(EOObserverCenter.java:399)
    at com.webobjects.eocontrol.EOCustomObject.willChange(EOCustomObject.java:333)
    at com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer$_GenericRecordBinding.setValueInObject(_EOMutableKnownKeyDictionary.java:579)
    at com.webobjects.eocontrol.EOCustomObject.takeStoredValueForKey(EOCustomObject.java:1663)
    at er.extensions.eof.ERXGenericRecord.takeStoredValueForKey(ERXGenericRecord.java:1261)
    at net.logicsquad.hydromaster.model.core._SummaryLine.setOrder(_SummaryLine.java:163)
    at net.logicsquad.hydromaster.model.core.SummaryLine.createSummaryLine(SummaryLine.java:212)
    at net.logicsquad.hydromaster.model.core.SummaryFile.createSummaryFile(SummaryFile.java:98)
    at net.logicsquad.hydromaster.test.model.core.SummaryFileTest.allTestFilesShouldBeParseable(SummaryFileTest.java:40)
    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:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at com.wounit.rules.AbstractEditingContextRule$1.evaluate(AbstractEditingContextRule.java:165)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Needless to say, I have ERAttributeExtension.framework on the classpath, and there are no issues with Joda attributes in the running application. Further, the tests all pass post-build on Jenkins.

The issue turns out to be due to having ERJars.framework (and ERExtensions.framework) open as projects in the workspace when running the tests. Close those projects, and the tests all pass.

Is this a classpath ordering thing? Is Eclipse setting up a different order than what I get when I use the wopath Ant element? And could that be affecting the tests?

Anyway, this is solved, and just preserved here for future reference. This is depressingly brittle.

@paulhoadley
Copy link
Author

As noted, the workaround is to make sure ERJars and ERExtensions projects are not open in the workspace when running the tests under Eclipse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant