hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Lewis Ship <hls...@gmail.com>
Subject Re: Problem with hivemind.lib.ServicePropertyFactory
Date Sat, 16 Apr 2005 14:48:35 GMT
There were bugs in HiveMind 1.0 where a service that inherited different 
implementations of the same method (with different thrown exceptions) would 
trip up the interceptor building code. It would tend to try and add the same 
method, with different thrown exceptions, twice. That is fixed in 1.1, it 
does a more sophisticated job of enumerating the methods, and skips methods 
that are "trumped" by other methods (with same parameters, but more 
inclusive thrown exceptions). I suspect that could be the problem.


On 4/13/05, Hensley, Richard <Richard.Hensley@mckesson.com> wrote:
> 
> Upon further study, it seems that the user of interceptors is causing the
> problem.
> 
> <service-point id="avc"
> interface="com.mckesson.lab.services.ApplicationVisitContext">
> <interceptor service-id="com.mckesson.adept.TimerInterceptor" />
> 
> </service-point>
> 
> <implementation service-id="avc">
> <create-instance
> class="com.mckesson.lab.services.impl.ApplicationVisitContextImpl"
> model="threaded" />
> </implementation>
> 
> This configuration fails with the exception noted below.
> 
> The same configuration without the interceptor works correctly.
> <service-point id="avc"
> interface="com.mckesson.lab.services.ApplicationVisitContext">
> </service-point>
> 
> <implementation service-id="avc">
> <create-instance
> class="com.mckesson.lab.services.impl.ApplicationVisitContextImpl"
> model="threaded" />
> </implementation>
> 
> I can work around this in Hivemind 1.0, can anybody tell me if Hivemind 
> 1.1
> exhibits the same behavior?
> 
> Richard
> 
> -----Original Message-----
> From: Hensley, Richard [mailto:Richard.Hensley@McKesson.com]
> Sent: Tuesday, April 12, 2005 5:33 PM
> To: hivemind-user@jakarta.apache.org
> Subject: RE: Problem with hivemind.lib.ServicePropertyFactory
> 
> However, when I use this configuration:
> 
> <service-point id="avc"
> interface="com.mckesson.lab.services.ApplicationVisitContext">
> <create-instance
> class="com.mckesson.lab.services.impl.ApplicationVisitContextImpl"
> model="threaded" />
> </service-point>
> 
> <service-point id="User"
> interface="com.mckesson.lab.objects.security.User">
> <invoke-factory model="singleton"
> service-id="hivemind.lib.ServicePropertyFactory">
> <construct service-id="avc" property="user" />
> </invoke-factory>
> </service-point>
> 
> Which simply does not use a separation of service and implementation, the
> code works as expected. I'm trying to track this down, but I got lost in 
> the
> mire of ServicePropertyFactory.
> 
> Richard
> 
> -----Original Message-----
> From: Hensley, Richard [mailto:Richard.Hensley@McKesson.com]
> Sent: Tuesday, April 12, 2005 5:19 PM
> To: hivemind-user@jakarta.apache.org
> Subject: 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
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com

Mime
View raw message