You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by "Hensley, Richard" <Ri...@McKesson.com> on 2005/04/13 02:18:52 UTC

Problem with hivemind.lib.ServicePropertyFactory

I have the following configuration:

    <service-point id="ApplicationVisitContext"
interface="com.mckesson.lab.services.ApplicationVisitContext">
        <interceptor service-id="com.mckesson.adept.TimerInterceptor" />

        <interceptor service-id="com.mckesson.adept.LoggerInterceptor" />
    </service-point>

    <implementation
service-id="com.mckesson.lab.services.ApplicationVisitContext">
        <create-instance
class="com.mckesson.lab.services.impl.ApplicationVisitContextImpl"
model="threaded" />
    </implementation>

    <service-point id="User"
interface="com.mckesson.lab.objects.security.User">
        <invoke-factory model="singleton"
service-id="hivemind.lib.ServicePropertyFactory">
            <construct
service-id="com.mckesson.lab.services.ApplicationVisitContext"
property="user" />
        </invoke-factory>
    </service-point>

When I execute the following code:

    public void testUserService() {
        Registry registry = RegistryBuilder.constructDefaultRegistry();
        User user = (User) registry.getService(User.class);
        user.getUserId();
    }

I get the following exception:

org.apache.hivemind.ApplicationRuntimeException: Unable to construct service
com.mckesson.lab.services.impl.User: Unable to add method
com.mckesson.lab.objects.security.User _targetServiceProperty() to class
$ServicePropertyProxy_10338ea728a_35: [source error] Method getUser not
found in com.mckesson.lab.objects.security.User
	at
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructNewS
erviceImplementation(AbstractServiceModelImpl.java:156)
	at
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructServ
iceImplementation(AbstractServiceModelImpl.java:130)
	at
org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getActualService
Implementation(SingletonServiceModel.java:69)
	at
$InnerProxy_10338ea7225_25._service($InnerProxy_10338ea7225_25.java)
	at
$InnerProxy_10338ea7225_25.getUserId($InnerProxy_10338ea7225_25.java)
	at
$SingletonProxy_10338ea7225_24.getUserId($SingletonProxy_10338ea7225_24.java
)
	at
com.mckesson.lab.services.impl.UserServiceTest.testUserService(UserServiceTe
st.java:21)
	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 junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	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(RemoteTestRu
nner.java:436)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:311)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
.java:192)
Caused by: org.apache.hivemind.ApplicationRuntimeException: Unable to add
method com.mckesson.lab.objects.security.User _targetServiceProperty() to
class $ServicePropertyProxy_10338ea728a_35: [source error] Method getUser
not found in com.mckesson.lab.objects.security.User
	at
org.apache.hivemind.impl.InvokeFactoryServiceConstructor.constructCoreServic
eImplementation(InvokeFactoryServiceConstructor.java:100)
	at
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructCore
ServiceImplementation(AbstractServiceModelImpl.java:100)
	at
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructNewS
erviceImplementation(AbstractServiceModelImpl.java:148)
	... 21 more
Caused by: org.apache.hivemind.ApplicationRuntimeException: Unable to add
method com.mckesson.lab.objects.security.User _targetServiceProperty() to
class $ServicePropertyProxy_10338ea728a_35: [source error] Method getUser
not found in com.mckesson.lab.objects.security.User
	at
org.apache.hivemind.service.impl.ClassFabImpl.addMethod(ClassFabImpl.java:11
0)
	at
org.apache.hivemind.lib.impl.ServicePropertyFactory.addInfrastructure(Servic
ePropertyFactory.java:116)
	at
org.apache.hivemind.lib.impl.ServicePropertyFactory.createCoreServiceImpleme
ntation(ServicePropertyFactory.java:72)
	at
$InnerProxy_10338ea722f_27.createCoreServiceImplementation($InnerProxy_10338
ea722f_27.java)
	at
$SingletonProxy_10338ea722f_26.createCoreServiceImplementation($SingletonPro
xy_10338ea722f_26.java)
	at
org.apache.hivemind.impl.InvokeFactoryServiceConstructor.constructCoreServic
eImplementation(InvokeFactoryServiceConstructor.java:91)
	... 23 more
Caused by: javassist.CannotCompileException: [source error] Method getUser
not found in com.mckesson.lab.objects.security.User
	at javassist.CtBehavior.setBody(CtBehavior.java:163)
	at javassist.CtMethod.setBody(CtMethod.java:311)
	at
org.apache.hivemind.service.impl.ClassFabImpl.addMethod(ClassFabImpl.java:10
2)
	... 28 more


It is telling me that it is trying to call getUser() on the User interface,
however this does not seem to be what the documentation says it is supposed
to be doing. 

Does anybody have any suggestions as to what went wrong?

Richard


---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org