Ok, not very specific, but I found what you are referring to.

Unfortunately @Local annotation on the override itself doesn't help. It seems like I have to define local versions of all dependencies, which is something I'd really like to avoid for stateless services. A similar structure of services worked with Hivemind and T4, so I wonder if there's a way to make it work in T5 as well? (other than binding concrete service implementation at the app level to avoid overrides)

Andrus


On Apr 2, 2010, at 4:21 PM, Howard Lewis Ship wrote:

http://tapestry.apache.org/tapestry5.1/tapestry-ioc/cookbook/override.html

On Fri, Apr 2, 2010 at 3:58 AM, Andrus Adamchik <and...@objectstyle.org > wrote:
Hi guys,

having a bit of trouble overriding my services with T5.2 (build from a few days ago ... can't use 5.1 due to some bugs that got fixed in 5.2). I have
AppModule and a submodule:

@SubModule( { ServicesModule.class })
public class AppModule {

       public static void bind(ServiceBinder binder) {
// this works if ISiteService is not bound in ServicesModule // binder.bind(ISiteService.class, MySiteService.class);
       }

       public static void contributeServiceOverride(
MappedConfiguration<Class<?>, Object> configuration)
{

               // this fails with exception below
               configuration.addInstance(ISiteService.class,
MySiteService.class);
       }
}

On startup I get an error below about recursive loading of
'ServiceOverride'. MySiteService has a long chain of dependencies, but nothing is recursive in it. If instead I override with a mock service with
no dependencies, things work. So the culprit here is not the custom
services, but rather Tapestry 'ServiceOverride'. Any idea what's wrong?

Thanks,
Andrus


[02/Apr/2010:13:50:03] main  ERROR Registry: Construction of service
'ServiceOverride' has failed due to recursion: the service depends on itself
in some way. Please check
org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl(Map) (at
ServiceOverrideImpl.java:31) via
org .apache .tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:46) for references to another service that is itself
dependent on service 'ServiceOverride'.
[02/Apr/2010:13:50:03] main  ERROR Registry: Operations trace:
[02/Apr/2010:13:50:03] main  ERROR Registry: [ 1] Realizing service
ServletApplicationInitializer
[02/Apr/2010:13:50:03] main  ERROR Registry: [ 2] Invoking
org .apache .tapestry5 .services.TapestryModule.buildServletApplicationInitializer(Logger,
List, ApplicationInitializer) (at TapestryModule.java:1435)
[02/Apr/2010:13:50:03] main ERROR Registry: [ 3] Constructing module class
org.apache.tapestry5.services.TapestryModule
[02/Apr/2010:13:50:03] main ERROR Registry: [ 4] Determining injection value for parameter #1 (org.apache.tapestry5.ioc.services.PipelineBuilder) [02/Apr/2010:13:50:03] main ERROR Registry: [ 5] Resolving object of type org.apache.tapestry5.ioc.services.PipelineBuilder using MasterObjectProvider
[02/Apr/2010:13:50:03] main  ERROR Registry: [ 6] Realizing service
ServiceOverride
[02/Apr/2010:13:50:03] main  ERROR Registry: [ 7] Invoking
org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl(Map) (at
ServiceOverrideImpl.java:31) via
org .apache .tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at
TapestryIOCModule.java:46)
[02/Apr/2010:13:50:03] main ERROR Registry: [ 8] Determining injection
value for parameter #1 (java.util.Map)
[02/Apr/2010:13:50:03] main  ERROR Registry: [ 9] Collecting mapped
configuration for service ServiceOverride
[02/Apr/2010:13:50:03] main  ERROR Registry: [10] Invoking method
xxxxx .services.AppModule.contributeServiceOverride(MappedConfiguration) (at
AppModule.java:25).
[02/Apr/2010:13:50:03] main ERROR Registry: [11] Autobuilding instance of
class xxxxx.services.site.MySiteService
[02/Apr/2010:13:50:03] main ERROR Registry: [12] Determining injection
value for parameter #1 (xxxx.service.db.IDataService)
[02/Apr/2010:13:50:03] main ERROR Registry: [13] Resolving object of type
xxxx.service.db.IDataService using MasterObjectProvider
[02/Apr/2010:13:50:03] main  ERROR Registry: [14] Realizing service
ServiceOverride
[02/Apr/2010:13:50:03] main ERROR ServiceOverride: Construction of service
ServiceOverride failed: Error invoking constructor
org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl(Map) (at
ServiceOverrideImpl.java:31) via
org .apache .tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:46) (for service 'ServiceOverride'): Error invoking
service contribution method
xxxxx .services.AppModule.contributeServiceOverride(MappedConfiguration): Error invoking constructor xxxxx.services.site.MySiteService(IDataService)
(at MySiteService.java:16) (for service 'ServiceOverride'): Exception
constructing service 'ServiceOverride': Construction of service
'ServiceOverride' has failed due to recursion: the service depends on itself
in some way. Please check
org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl(Map) (at
ServiceOverrideImpl.java:31) via
org .apache .tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:46) for references to another service that is itself
dependent on service 'ServiceOverride'.
...

java.lang.IllegalStateException: Construction of service 'ServiceOverride' has failed due to recursion: the service depends on itself in some way.
Please check
org.apache.tapestry5.ioc.internal.services.ServiceOverrideImpl(Map) (at
ServiceOverrideImpl.java:31) via
org .apache .tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:46) for references to another service that is itself
dependent on service 'ServiceOverride'.
       at
org .apache .tapestry5 .ioc .internal .RecursiveServiceCreationCheckWrapper .createObject(RecursiveServiceCreationCheckWrapper.java:52)
       at
org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator $1.invoke(OperationTrackingObjectCreator.java:45)
       at
org .apache .tapestry5 .ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java: 68)





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org





--
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to