You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michael Prescott <mi...@gmail.com> on 2013/04/01 20:37:08 UTC
Service Advisors recursive problem
I'm having trouble applying service advisor according to the instructions
here:
My TapestryModule contains only this, as per the example on
http://tapestry.apache.org/service-advisors.html :
@Match("*")
public static void adviseLogging(LoggingAdvisor loggingAdvisor,
Logger logger, MethodAdviceReceiver receiver)
{
loggingAdvisor.addLoggingAdvice(logger, receiver);
}
This leads to a recursive IoC exeption:
2013-04-01 14:35:01,252 [main] ERROR org.apache.tapestry5.ioc.Registry
- Construction of service 'AssetObjectProvider' h
as failed due to recursion: the service depends on itself in some way.
Please check org.apache.tapestry5.internal.servic
es.AssetObjectProvider(AssetSource, TypeCoercer, SymbolSource) (at
AssetObjectProvider.java:45) via org.apache.tapestry5
.services.TapestryModule.bind(ServiceBinder) (at
TapestryModule.java:308) for references to another service that is
itse
lf dependent on service 'AssetObjectProvider'.
2013-04-01 14:35:01,253 [main] ERROR org.apache.tapestry5.ioc.Registry
- Operations trace:
2013-04-01 14:35:01,254 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 1] Realizing service ServletApplicationInitia
lizer
2013-04-01 14:35:01,255 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 2] Instantiating service ServletApplicationIn
itializer implementation via
org.apache.tapestry5.services.TapestryModule.buildServletApplicationInitializer(Logger,
Lis
t, ApplicationInitializer) (at TapestryModule.java:1396)
2013-04-01 14:35:01,256 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 3] Constructing module class org.apache.tapes
try5.services.TapestryModule
2013-04-01 14:35:01,257 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 4] Determining injection value for parameter
#1 (org.apache.tapestry5.ioc.services.PipelineBuilder)
2013-04-01 14:35:01,258 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 5] Resolving object of type org.apache.tapest
ry5.ioc.services.PipelineBuilder using MasterObjectProvider
2013-04-01 14:35:01,259 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 6] Realizing service AssetObjectProvider
2013-04-01 14:35:01,259 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 7] Invoking com.tsg.fss.web.services.Tapestry
Module.adviseLogging(LoggingAdvisor, Logger, MethodAdviceReceiver) (at
TapestryModule.java:107)
2013-04-01 14:35:01,261 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 8] Creating plan to invoke public static void
com.tsg.fss.web.services.TapestryModule.adviseLogging(org.apache.tapestry5.ioc.services.LoggingAdvisor,org.slf4j.Logger
,org.apache.tapestry5.ioc.MethodAdviceReceiver)
2013-04-01 14:35:01,261 [main] ERROR org.apache.tapestry5.ioc.Registry
- [ 9] Determining injection value for parameter
#1 (org.apache.tapestry5.ioc.services.LoggingAdvisor)
2013-04-01 14:35:01,262 [main] ERROR org.apache.tapestry5.ioc.Registry
- [10] Resolving object of type org.apache.tapest
ry5.ioc.services.LoggingAdvisor using MasterObjectProvider
2013-04-01 14:35:01,263 [main] ERROR org.apache.tapestry5.ioc.Registry
- [11] Realizing service AssetObjectProvider
2013-04-01 14:35:01,268 [main] ERROR
org.apache.tapestry5.services.TapestryModule.AssetObjectProvider -
Construction of
service AssetObjectProvider failed: Exception constructing service
'AssetObjectProvider': Construction of service 'Asset
ObjectProvider' has failed due to recursion: the service depends on
itself in some way. Please check org.apache.tapestry
5.internal.services.AssetObjectProvider(AssetSource, TypeCoercer,
SymbolSource) (at AssetObjectProvider.java:45) via org
.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at
TapestryModule.java:308) for references to another ser
vice that is itself dependent on service 'AssetObjectProvider'.
Caused by: java.lang.IllegalStateException: Construction of service
'AssetObjectProvider' has failed due to recursion: the service depends
on itself in some way. Please check
org.apache.tapestry5.internal.services.AssetObjectProvider(AssetSource,
TypeCoercer, SymbolSource) (at AssetObjectProvider.java:45) via
org.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at
TapestryModule.java:308) for references to another service that is
itself dependent on service 'AssetObjectProvider'.
Re: Service Advisors recursive problem
Posted by Cezary Biernacki <ce...@gmail.com>.
My solution to similar problem was to use following pattern that
excluded services that lead to recursion:
@Match("(?!(" +
"Request" +
"|ObjectProvider" +
"|AssetObjectProvider" +
"|PerRequestCache" +
"|Alias" +
"|AliasManager" +
"|ServiceOverride" +
"|Logger" +
"|Registry" +
"|ApplicationDefaults" +
"|SymbolProvider" +
"|SymbolSource" +
"|SymbolObjectProvider" +
"|MasterObjectProvider" +
"|ObjectLocator" +
"|ServletApplicationInitializer" +
"|PipelineBuilder" +
"|TypeCoercer" +
"|ServiceAdvisor)).*")
I can not say that it is the best way, but it worked for me (Tapestry 5.2).
Generally you should avoid decorating/advising everything.
Best regards,
Cezary
On Mon, 1 Apr 2013 14:37:08 -0400 Michael Prescott
<mi...@gmail.com> wrote:
> I'm having trouble applying service advisor according to the instructions
> here:
>
> My TapestryModule contains only this, as per the example on
> http://tapestry.apache.org/service-advisors.html :
>
>
> @Match("*")
> public static void adviseLogging(LoggingAdvisor loggingAdvisor,
> Logger logger, MethodAdviceReceiver receiver)
> {
> loggingAdvisor.addLoggingAdvice(logger, receiver);
> }
>
> This leads to a recursive IoC exeption:
>
> 2013-04-01 14:35:01,252 [main] ERROR org.apache.tapestry5.ioc.Registry
> - Construction of service 'AssetObjectProvider' h
>
> as failed due to recursion: the service depends on itself in some way.
> Please check org.apache.tapestry5.internal.servic
>
> es.AssetObjectProvider(AssetSource, TypeCoercer, SymbolSource) (at
> AssetObjectProvider.java:45) via org.apache.tapestry5
>
> .services.TapestryModule.bind(ServiceBinder) (at
> TapestryModule.java:308) for references to another service that is
> itse
>
> lf dependent on service 'AssetObjectProvider'.
>
> 2013-04-01 14:35:01,253 [main] ERROR org.apache.tapestry5.ioc.Registry
> - Operations trace:
>
> 2013-04-01 14:35:01,254 [main] ERROR org.apache.tapestry5.ioc.Registry
> - [ 1] Realizing service ServletApplicationInitia
>
> lizer
>
> 2013-04-01 14:35:01,255 [main] ERROR org.apache.tapestry5.ioc.Registry
> - [ 2] Instantiating service ServletApplicationIn
>
> itializer implementation via
> org.apache.tapestry5.services.TapestryModule.buildServletApplicationInitializer(Logger,
> Lis
>
> t, ApplicationInitializer) (at TapestryModule.java:1396)
>
> 2013-04-01 14:35:01,256 [main] ERROR org.apache.tapestry5.ioc.Registry
> - [ 3] Constructing module class org.apache.tapes
>
> try5.services.TapestryModule
>
> 2013-04-01 14:35:01,257 [main] ERROR org.apache.tapestry5.ioc.Registry
> - [ 4] Determining injection value for parameter
>
> #1 (org.apache.tapestry5.ioc.services.PipelineBuilder)
>
> 2013-04-01 14:35:01,258 [main] ERROR org.apache.tapestry5.ioc.Registry
> - [ 5] Resolving object of type org.apache.tapest
>
> ry5.ioc.services.PipelineBuilder using MasterObjectProvider
>
> 2013-04-01 14:35:01,259 [main] ERROR org.apache.tapestry5.ioc.Registry
> - [ 6] Realizing service AssetObjectProvider
>
> 2013-04-01 14:35:01,259 [main] ERROR org.apache.tapestry5.ioc.Registry
> - [ 7] Invoking com.tsg.fss.web.services.Tapestry
>
> Module.adviseLogging(LoggingAdvisor, Logger, MethodAdviceReceiver) (at
> TapestryModule.java:107)
>
> 2013-04-01 14:35:01,261 [main] ERROR org.apache.tapestry5.ioc.Registry
> - [ 8] Creating plan to invoke public static void
>
> com.tsg.fss.web.services.TapestryModule.adviseLogging(org.apache.tapestry5.ioc.services.LoggingAdvisor,org.slf4j.Logger
>
> ,org.apache.tapestry5.ioc.MethodAdviceReceiver)
>
> 2013-04-01 14:35:01,261 [main] ERROR org.apache.tapestry5.ioc.Registry
> - [ 9] Determining injection value for parameter
>
> #1 (org.apache.tapestry5.ioc.services.LoggingAdvisor)
>
> 2013-04-01 14:35:01,262 [main] ERROR org.apache.tapestry5.ioc.Registry
> - [10] Resolving object of type org.apache.tapest
>
> ry5.ioc.services.LoggingAdvisor using MasterObjectProvider
>
> 2013-04-01 14:35:01,263 [main] ERROR org.apache.tapestry5.ioc.Registry
> - [11] Realizing service AssetObjectProvider
>
> 2013-04-01 14:35:01,268 [main] ERROR
> org.apache.tapestry5.services.TapestryModule.AssetObjectProvider -
> Construction of
>
> service AssetObjectProvider failed: Exception constructing service
> 'AssetObjectProvider': Construction of service 'Asset
>
> ObjectProvider' has failed due to recursion: the service depends on
> itself in some way. Please check org.apache.tapestry
>
> 5.internal.services.AssetObjectProvider(AssetSource, TypeCoercer,
> SymbolSource) (at AssetObjectProvider.java:45) via org
>
> .apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at
> TapestryModule.java:308) for references to another ser
>
> vice that is itself dependent on service 'AssetObjectProvider'.
>
>
> Caused by: java.lang.IllegalStateException: Construction of service
> 'AssetObjectProvider' has failed due to recursion: the service depends
> on itself in some way. Please check
> org.apache.tapestry5.internal.services.AssetObjectProvider(AssetSource,
> TypeCoercer, SymbolSource) (at AssetObjectProvider.java:45) via
> org.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at
> TapestryModule.java:308) for references to another service that is
> itself dependent on service 'AssetObjectProvider'.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org