I am a little bit confused by the message of an exception thrown when
a service could not properly be created.
To show this I created the following hivemind (snippet):
<service-point id="ServiceAWithAW" interface="test.IService">
<invoke-factory>
<construct class="test.ServiceA" autowire-services="true">
<service>moved.ServiceB</service>
</construct>
</invoke-factory>
</service-point>
<service-point id="ServiceAWithoutAW" interface="test.IService">
<invoke-factory>
<construct class="test.ServiceA" autowire-services="false">
<service>moved.ServiceB</service>
</construct>
</invoke-factory>
</service-point>
<service-point id="ServiceB" interface="test.IService">
<!-- Refactoring/typing error/.. caused that this service is
no longer referenced by the services above!! -->
<create-instance class="test.ServiceB"/>
</service-point>
When requesting service �ServiceAWithAW� (autowire-services="true") I got the
exception:
org.apache.hivemind.ApplicationRuntimeException: Unable to construct service
spirit.core.base.microkernel.hivemind.ServiceAWithAW: HiveMind configuration
problem: Error building service
spirit.core.base.microkernel.hivemind.ServiceAWithAW: Unable to find
constructor applicable for autowiring. Use explicit constructor parameters. At:
file:/C:/projekte/spirit/de.compeople.spirit.core.base/bin/de/compeople/spirit/core/base/microkernel/hivemind/badconstruct.xml,
line 14, column 108 with exception: Unable to find constructor applicable for
autowiring. Use explicit constructor parameters.
[file:/C:/projekte/spirit/de.compeople.spirit.core.base/bin/de/compeople/spirit/core/base/microkernel/hivemind/badconstruct.xml,
line 13, column 19]
at
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructNewServiceImplementation(AbstractServiceModelImpl.java:164)
at
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructServiceImplementation(AbstractServiceModelImpl.java:138)
at
org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getActualServiceImplementation(SingletonServiceModel.java:68)
at $IService_1028bc7a837._service($IService_1028bc7a837.java)
at $IService_1028bc7a837.go($IService_1028bc7a837.java)
at $IService_1028bc7a836.go($IService_1028bc7a836.java)
at
de.compeople.spirit.core.base.microkernel.hivemind.BadConstructTest.testWithAutowire(BadConstructTest.java:28)
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:585)
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
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:598)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:354)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:219)
Caused by: org.apache.hivemind.ApplicationRuntimeException: HiveMind
configuration problem: Error building service
spirit.core.base.microkernel.hivemind.ServiceAWithAW: Unable to find
constructor applicable for autowiring. Use explicit constructor parameters. At:
file:/C:/projekte/spirit/de.compeople.spirit.core.base/bin/de/compeople/spirit/core/base/microkernel/hivemind/badconstruct.xml,
line 14, column 108 with exception: Unable to find constructor applicable for
autowiring. Use explicit constructor parameters.
[file:/C:/projekte/spirit/de.compeople.spirit.core.base/bin/de/compeople/spirit/core/base/microkernel/hivemind/badconstruct.xml,
line 13, column 19]
at
org.apache.hivemind.impl.InvokeFactoryServiceConstructor.constructCoreServiceImplementation(InvokeFactoryServiceConstructor.java:88)
at
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructCoreServiceImplementation(AbstractServiceModelImpl.java:106)
at
org.apache.hivemind.impl.servicemodel.AbstractServiceModelImpl.constructNewServiceImplementation(AbstractServiceModelImpl.java:156)
... 19 more
Caused by: org.apache.hivemind.ApplicationRuntimeException: HiveMind
configuration problem: Error building service
spirit.core.base.microkernel.hivemind.ServiceAWithAW: Unable to find
constructor applicable for autowiring. Use explicit constructor parameters. At:
file:/C:/projekte/spirit/de.compeople.spirit.core.base/bin/de/compeople/spirit/core/base/microkernel/hivemind/badconstruct.xml,
line 14, column 108 with exception: Unable to find constructor applicable for
autowiring. Use explicit constructor parameters.
[file:/C:/projekte/spirit/de.compeople.spirit.core.base/bin/de/compeople/spirit/core/base/microkernel/hivemind/badconstruct.xml,
line 14, column 108]
at
de.compeople.spirit.core.base.microkernel.hivemind.HiveMindErrorHandler.error(HiveMindErrorHandler.java:93)
at org.apache.hivemind.impl.ErrorLogImpl.error(ErrorLogImpl.java:40)
at
org.apache.hivemind.service.impl.BuilderFactoryLogic.error(BuilderFactoryLogic.java:98)
at
org.apache.hivemind.service.impl.BuilderFactoryLogic.createService(BuilderFactoryLogic.java:87)
at
org.apache.hivemind.service.impl.BuilderFactory.createCoreServiceImplementation(BuilderFactory.java:42)
at
org.apache.hivemind.impl.InvokeFactoryServiceConstructor.constructCoreServiceImplementation(InvokeFactoryServiceConstructor.java:84)
... 21 more
Caused by: org.apache.hivemind.ApplicationRuntimeException: Unable to find
constructor applicable for autowiring. Use explicit constructor parameters.
[file:/C:/projekte/spirit/de.compeople.spirit.core.base/bin/de/compeople/spirit/core/base/microkernel/hivemind/badconstruct.xml,
line 14, column 108]
at
org.apache.hivemind.service.impl.BuilderFactoryLogic.instantiateExplicitConstructorInstance(BuilderFactoryLogic.java:141)
at
org.apache.hivemind.service.impl.BuilderFactoryLogic.instantiateCoreServiceInstance(BuilderFactoryLogic.java:112)
at
org.apache.hivemind.service.impl.BuilderFactoryLogic.createService(BuilderFactoryLogic.java:77)
... 23 more
When requesting service �ServiceAWithoutAW� (autowire-services="false") I got
exactly the same messages.
So, either hivemind (1.1 alpha 2) tries to autowire this service, which I
switched
off explicitly or the exception message is simply confusing.
However, what the exception doesn�t tell me is that the service
�moved.ServiceB� could
not be found, which is the cause of the problem. Also the reported line number
14 does
not point to line with <service>moved.ServiceB</service> but the line above.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]