I've figured out that it was me didn't include JavaMemoryAdaptor Framework. I only notice this until I copy the stacktrace from Junit perspective and found out following line:

Caused by: java.lang.IllegalStateException: Unable to get the name of the class to instantiate for the adaptor framework JavaMemoryAdaptor. The possible causes for this error are: the adaptor framework is not installed on your system, the adaptor framework is not linked into your application, or the info dictionary for this adaptor is corrupted.

I should have look at it more carefully. My Bad. :)

Regards,
Harvey


On 14/12/2009, at 5:47 PM, M.Y. Tjoe wrote:

Hi Paul,

I've following code in setup which should do the tricks but it was never called:

        public void setUp() throws Exception {
                
if(EOModelGroup.defaultGroup().modelNamed("MyModelForTest")==null) {
                        
EOModelGroup.defaultGroup().addModelWithPath(PATH_TO_MYTESTMODEL);
                        System.out.println("MyModelForTest has been manually 
loaded.");
                }
        }


and this is the log shown in console:

[2009-12-14 17:39:50 EST] <main> Initialized : er.extensions.ERXExtensions [2009-12-14 17:39:50 EST] <main> Initialized : er.prototypes.ERPrototypes


and this is the exception:

com.webobjects.foundation.NSForwardException [java.lang.reflect.InvocationTargetException] null:java.lang.reflect.InvocationTargetException at com .webobjects .foundation ._NSUtilities._explainInstantiationException(_NSUtilities.java:600) at com .webobjects .foundation ._NSUtilities.instantiateObjectWithConstructor(_NSUtilities.java:639) at com .webobjects .eoaccess .EOEntityClassDescription .createInstanceWithEditingContext(EOEntityClassDescription.java:242) at com .webobjects .eoaccess.EOUtilities.createAndInsertInstance(EOUtilities.java:861) at tjoe.myframework.test.eo._MyTestEO.createMyTestEO(_MyTestEO.java: 62)
        at tjoe.myframework.test.eo.MyTestEO.getMyTestEO(MyTestEO.java:12)
at tjoe .myframework .test.MyTestUtilitiesTest.testSameEcNSArray(MyTestUtilitiesTest.java: 70)
        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:592)
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 .internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org .junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java: 31)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org .eclipse .jdt .internal .junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45) at org .eclipse .jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org .eclipse .jdt .internal .junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org .eclipse .jdt .internal .junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org .eclipse .jdt .internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org .eclipse .jdt .internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java: 196)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun .reflect .NativeConstructorAccessorImpl .newInstance(NativeConstructorAccessorImpl.java:39) at sun .reflect .DelegatingConstructorAccessorImpl .newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:501)
at com .webobjects .foundation ._NSUtilities.instantiateObjectWithConstructor(_NSUtilities.java:633)
        ... 31 more
Caused by: java.lang.IllegalStateException: Unable to get the name of the class to instantiate for the adaptor framework JavaMemoryAdaptor. The possible causes for this error are: the adaptor framework is not installed on your system, the adaptor framework is not linked into your application, or the info dictionary for this adaptor is corrupted. at com .webobjects.eoaccess.EOAdaptor.classForAdaptorNamed(EOAdaptor.java: 264) at com.webobjects.eoaccess.EOAdaptor.adaptorWithName(EOAdaptor.java: 287) at com.webobjects.eoaccess.EOAdaptor.adaptorWithModel(EOAdaptor.java:312) at com.webobjects.eoaccess.EOModel.createPrototypeCache(EOModel.java:624) at com.webobjects.eoaccess.EOModel.prototypeAttributeNamed(EOModel.java: 699)
        at com.webobjects.eoaccess.EOAttribute.<init>(EOAttribute.java:998)
        at com.webobjects.eoaccess.EOEntity.attributes(EOEntity.java:816)
        at com.webobjects.eoaccess.EOEntity.attributeNamed(EOEntity.java:789)
at com.webobjects.eoaccess.EOEntity.classProperties(EOEntity.java: 1098) at com .webobjects .eoaccess.EOEntity._propertyDictionaryInitializer(EOEntity.java:3321) at com .webobjects .eoaccess.EOEntity._newDictionaryForProperties(EOEntity.java:3667) at com .webobjects .eoaccess .EOEntityClassDescription ._newDictionaryForProperties(EOEntityClassDescription.java:88) at com .webobjects .eocontrol .EOGenericRecord.__setClassDescription(EOGenericRecord.java:111) at com .webobjects .eocontrol .EOGenericRecord.__setClassDescription(EOGenericRecord.java:100) at com.webobjects.eocontrol.EOGenericRecord.<init>(EOGenericRecord.java: 73) at er.extensions.eof.ERXGenericRecord.<init>(ERXGenericRecord.java: 98)
        at tjoe.myframework.test.eo._MyTestEO.<init>(_MyTestEO.java:15)
        at tjoe.myframework.test.eo.MyTestEO.<init>(MyTestEO.java:7)
        ... 36 more


Regards,
Harvey


On 14/12/2009, at 5:26 PM, Paul Hoadley wrote:

On 14/12/2009, at 4:35 PM, M.Y. Tjoe wrote:

Anybody has any update on this issues? I am the next lucky winner for this one. I've updated to the latest Wonder library (2009-08-20) and using the latest Juint (4.8.1) but still have this problem. Tried ERXTestCase but that doesn't work for me. My test would not run at all which is good I guess. Also, I am using ERXMemoryAdaptor in the model so I don't know if this is not supported. Any help would be much appreciated.

I'm using JUnit4 and loading models manually when I need them. There may be a better way. In any case, in a superclass of all my test classes is this method:

        public static void setUp(String modelName) {
                try {
                        if (EOModelGroup.defaultGroup().modelNamed(modelName) 
== null) {
                                EOModel model =
                                                new EOModel(new 
File("Resources/" + modelName
                                                                + 
".eomodeld").toURI().toURL());
                                EOModelGroup.defaultGroup().addModel(model);
                        }
                } catch (MalformedURLException e) {
                        throw new RuntimeException("Could not load EO Model.");
                }
        }

That's called by the following method in the subclasses:

        @BeforeClass
        public static void setUp() {
                setUp(MODEL_NAME);
        }

Where MODEL_NAME is defined in the subclass to load the appropriate model. Loading the models manually like this seems to be sufficient to initialise Wonder. This appears on the console when I run any of these tests:

[2009-12-14 16:12:51 CST] <main> Initialized : er.extensions.ERXExtensions [2009-12-14 16:12:51 CST] <main> Initialized : er.prototypes.ERPrototypes
[2009-12-14 16:12:51 CST] <main> Initialized : er.ajax.Ajax
[2009-12-14 16:12:51 CST] <main> Initialized : er.directtoweb.ERDirectToWeb
[2009-12-14 16:12:51 CST] <main> Initialized : er.javamail.ERJavaMail
[2009-12-14 16:12:51 CST] <main> Initialized : er.selenium.ERSelenium


Again, there may be a better way. But ensuring a model was never loaded twice seemed to get rid of the InvocationTargetExceptions I was getting.


--
Paul.

w  http://logicsquad.net/
h  http://paul.hoadley.name/



<ATT00001.txt>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to