James,
I am currently at home and a few hours before my vacation. I found a stacktrace from an old email to Keiji, the author of djUnit:
org.apache.hivemind.ApplicationRuntimeException:
$InnerProxy_10072722603_1.<init>($SingletonProxy_10072722490_0,
org.apache.hivemind.impl.servicemodel.SingletonServiceModel)
at org.apache.hivemind.impl.servicemodel.SingletonServiceModel.createSingletonProxy(SingletonServiceModel.java:114)
at org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getService(SingletonServiceModel.java:58)
at org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java:171)
at org.apache.hivemind.impl.ServicePointImpl.getService(ServicePointImpl.java:184)
at org.apache.hivemind.impl.RegistryImpl.getService(RegistryImpl.java:151)
at org.apache.hivemind.impl.RegistryImpl.startup(RegistryImpl.java:321)
at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(RegistryBuilder.java:417)
at org.apache.hivemind.impl.RegistryBuilder.constructDefaultRegistry(RegistryBuilder.java:711)
at hivemind.examples.HivemindTest.setUp(HivemindTest.java:22)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
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:324)
at jp.co.dgic.testing.common.DJUnitTestCaseClassLoader.main(DJUnitTestCaseClassLoader.java:121)
at jp.co.dgic.eclipse.jdt.internal.junit.runner.DJUnitRunner.main(DJUnitRunner.java:24)
Caused by: java.lang.NoSuchMethodException:
$InnerProxy_10072722603_1.<init>($SingletonProxy_10072722490_0,
org.apache.hivemind.impl.servicemodel.SingletonServiceModel)
at java.lang.Class.getConstructor0(Class.java:1937)
at java.lang.Class.getConstructor(Class.java:1027)
at org.apache.hivemind.impl.servicemodel.SingletonServiceModel.createSingletonProxy(SingletonServiceModel.java:103)
... 24 more
I am not sure whether this helps you that much. Keiji did not find it helpfull. I wrote a little unit test (something with hivemind). With that he could reproduce the problem. He gave me the attached patch.
Stefan
James Carman wrote:
Stefan,
Can you at least attach the exception stack traces? Do you have them? That might help me recreate the problem.
James -----Original Message-----
From: Stefan Liebig [mailto:[EMAIL PROTECTED] Sent: Thursday, May 05, 2005 11:56 AM
To: [email protected]
Subject: Re: djUnit: HIVEMIND-79
James,
Well, may be it is possible to write a unit test for this, but I think that this will be very tricky. For checking my test coverage within Eclipse I found djUnit, which does a good job. But the first time I have been using it with code that uses HiveMind I got exceptions. I talked to the author of djUnit and he analyzed the problem. He gave me the attached patch and with this patch everything works fine. To reproduce the problem you could simply get the djUnit plugin (assuming you are using Eclipse) and run it on some code using HM. My ClassLoader knowledge is not sufficent enough to judge whether his patch is ok and does not cause other problems!
Stefan
James Carman wrote:
Stefan,
What exactly is the problem? In order to patch the source, we usually
like to write a test case first that exhibits the bug. Then, we write the fix. Can you explain to me exactly what the issue is so that I can write a test case? Or, do you already have a test case?
Thanks,
James
-----Original Message----- *From:* Liebig, Stefan [mailto:[EMAIL PROTECTED] *Sent:* Monday, May 02, 2005 6:54 AM *To:* [email protected] *Subject:* djUnit: HIVEMIND-79
Can someone please have a look at this problem. The author
of djUnit already provided a patch for HM. If his patch
does not cause any other problems, it would be fine to
have it in HM 1.1.
The patch is attached here.
Stefan
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.hivemind.service.impl;
import java.util.ArrayList;
import java.util.List;
/**
* ClassLoader used to properly instantiate newly created classes.
*
* @author Howard Lewis Ship / Essl Christian
* @see org.apache.hivemind.service.impl.CtClassSource
*/
class ClassFactoryClassLoader extends ClassLoader
{
private List _loaders = new ArrayList();
public ClassFactoryClassLoader() {
super(Thread.currentThread().getContextClassLoader());
}
/**
* Invoked to create a new class instance from fabricated
bytecode.
*/ public Class loadClass(String name, byte[] bytecodes) { Class result = defineClass(name, bytecodes, 0, bytecodes.length); resolveClass(result); return result; } /** * Adds a delegate class loader to the list of delegate class loaders. */ public synchronized void addDelegateLoader(ClassLoader loader) { _loaders.add(loader); } /** * Searches each of the delegate class loaders for the given
class.
*/ protected synchronized Class findClass(String name) throws ClassNotFoundException { ClassNotFoundException cnfex = null; try { return super.findClass(name); } catch (ClassNotFoundException ex) { cnfex = ex; } int count = _loaders.size(); for (int i = 0; i < count; i++) { ClassLoader l = (ClassLoader) _loaders.get(i); try { return l.loadClass(name); } catch (ClassNotFoundException ex) { } } // Not found .. through the first exception throw cnfex; } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
