You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Joel Halbert <jo...@su3analytics.com> on 2008/11/26 17:58:40 UTC

T5: Construction of service 'Alias' has failed due to recursion: the service depends on itself in some way. Please check.

Hi,

I get the following:

"Caused by: java.lang.IllegalStateException: Construction of service
'Alias' has failed due to recursion: the service depends on itself in
some way. Please check
org.apache.tapestry5.services.TapestryModule.buildAlias(Logger, String,
AliasManager, Collection) (at TapestryModule.java:217) for references to
another service that is itself dependent on service 'Alias'."

When contributing the following alias:

public static void contributeAlias(
        Configuration<AliasContribution<MarkupWriterFactory>>
configuration, 
        @Inject @Symbol(SymbolConstants.CHARSET) final String
applicationCharset) {
        

configuration.add(AliasContribution.create(MarkupWriterFactory.class,
                        new
XhtmlMarkupWriterFactoryImpl(applicationCharset)));
        }


as per http://wiki.apache.org/tapestry/Tapestry5HowToXhtml


I've seen the other threads on this issue but they haven't helped.

Any ideas?

THanks,
Joel


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


Re: T5: Construction of service 'Alias' has failed due to recursion: the service depends on itself in some way. Please check.

Posted by Howard Lewis Ship <hl...@gmail.com>.
On Wed, Nov 26, 2008 at 6:30 PM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> Em Wed, 26 Nov 2008 14:35:16 -0300, Joel Halbert <jo...@su3analytics.com>
> escreveu:
>
>> the problem appears to be related to another conitribution method:
>>
>>        public void contributeApplicationDefaults(
>>                        MappedConfiguration<String, String> configuration,
>>                        @Inject
>>                        ApplicationGlobals applicationGlobals,
>>                        @Inject
>>                        SymbolSource symbolSource
>>        ) {
>
> Try making the method static. It worked for me in a very similar situation.
> My advice is to declare all modules methods as static unless you have a
> specific need to do otherwise.

In fact, this is one of the things I would change in T5; support for
non-static module methods should never have been added.
It's useful for a couple of edge cases (for instance, how
PipelineBuilder service is used in many places inside TapestryModule)
but it adds more confusion, I think, than benefit.  However, it's
there, and its now etched in stone.


>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: T5: Construction of service 'Alias' has failed due to recursion: the service depends on itself in some way. Please check.

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 26 Nov 2008 14:35:16 -0300, Joel Halbert <jo...@su3analytics.com>  
escreveu:

> the problem appears to be related to another conitribution method:
>
> 	public void contributeApplicationDefaults(
> 			MappedConfiguration<String, String> configuration,
> 			@Inject
> 			ApplicationGlobals applicationGlobals,
> 			@Inject
> 			SymbolSource symbolSource
> 	) {

Try making the method static. It worked for me in a very similar  
situation. My advice is to declare all modules methods as static unless  
you have a specific need to do otherwise.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: T5: Construction of service 'Alias' has failed due to recursion: the service depends on itself in some way. Please check.

Posted by Hugo Palma <hu...@gmail.com>.
As a workaround you could inject the symbol into the module constructor and
then use it in the contributeAlias method.

On Wed, Nov 26, 2008 at 5:44 PM, Joel Halbert <jo...@su3analytics.com> wrote:

> damn, my last email was sent before i'd finished...
>
> .
> .
>
> For the time being I'm going to solve the problem by hardwiring the
> charset
>
>    public static void contributeAlias(
>            Configuration<AliasContribution<MarkupWriterFactory>>
> configuration
>     ) {
>
> configuration.add(AliasContribution.create(MarkupWriterFactory.class,
>                             new XhtmlMarkupWriterFactoryImpl("UTF-8")));
>
>    }
>
>
> I should not imaging that injecting services into the alias contribution
> is something that will be required much  anyway....
>
>
> On Wed, 2008-11-26 at 17:42 +0000, Joel Halbert wrote:
> > For the time being I'm going to solve the problem by simply hardiwing
> > the  charset
> >
> >
> > On Wed, 2008-11-26 at 17:35 +0000, Joel Halbert wrote:
> > > the problem appears to be related to another conitribution method:
> > >
> > >     public void contributeApplicationDefaults(
> > >                     MappedConfiguration<String, String> configuration,
> > >                     @Inject
> > >                     ApplicationGlobals applicationGlobals,
> > >                     @Inject
> > >                     SymbolSource symbolSource
> > >     ) {
> > > .
> > > .
> > >
> > > when this is commented out it no longer throws the error, I guess the
> > > double dependency on SymbolSource is causing the problem...?
> > >
> > >
> > >
> > > On Wed, 2008-11-26 at 09:06 -0800, Howard Lewis Ship wrote:
> > > > 5.0.16 introduces much improved logging to the console when this
> > > > happens, it should help you diagnost what happened.  What I see looks
> > > > correct, but there may be something else going on that we can't see.
> > > >
> > > > On Wed, Nov 26, 2008 at 8:58 AM, Joel Halbert <jo...@su3analytics.com>
> wrote:
> > > > > Hi,
> > > > >
> > > > > I get the following:
> > > > >
> > > > > "Caused by: java.lang.IllegalStateException: Construction of
> service
> > > > > 'Alias' has failed due to recursion: the service depends on itself
> in
> > > > > some way. Please check
> > > > > org.apache.tapestry5.services.TapestryModule.buildAlias(Logger,
> String,
> > > > > AliasManager, Collection) (at TapestryModule.java:217) for
> references to
> > > > > another service that is itself dependent on service 'Alias'."
> > > > >
> > > > > When contributing the following alias:
> > > > >
> > > > > public static void contributeAlias(
> > > > >        Configuration<AliasContribution<MarkupWriterFactory>>
> > > > > configuration,
> > > > >        @Inject @Symbol(SymbolConstants.CHARSET) final String
> > > > > applicationCharset) {
> > > > >
> > > > >
> > > > >
> configuration.add(AliasContribution.create(MarkupWriterFactory.class,
> > > > >                        new
> > > > > XhtmlMarkupWriterFactoryImpl(applicationCharset)));
> > > > >        }
> > > > >
> > > > >
> > > > > as per http://wiki.apache.org/tapestry/Tapestry5HowToXhtml
> > > > >
> > > > >
> > > > > I've seen the other threads on this issue but they haven't helped.
> > > > >
> > > > > Any ideas?
> > > > >
> > > > > THanks,
> > > > > Joel
> > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
> --
> SU3 Analytics Ltd
> The Print House
> 18 Ashwin Street
> E8 3DL
> London
>
> Tel: +44 (0) 20 3051 8637
> Fax: +44 (0) 20 8196 2215
> Mob: +44 (0) 79 7431 0685
> www.su3analytics.com
>
> SU3 Analytics Ltd is a company registered in England and Wales under
> company number 06639473 at registered address 61b Oxford Gardens, London
> W10 5UJ, United Kingdom.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5: Construction of service 'Alias' has failed due to recursion: the service depends on itself in some way. Please check.

Posted by Joel Halbert <jo...@su3analytics.com>.
damn, my last email was sent before i'd finished...

.
.

For the time being I'm going to solve the problem by hardwiring the
charset

    public static void contributeAlias(
            Configuration<AliasContribution<MarkupWriterFactory>>
configuration
    ) {

configuration.add(AliasContribution.create(MarkupWriterFactory.class,
                            new XhtmlMarkupWriterFactoryImpl("UTF-8")));
            
    } 


I should not imaging that injecting services into the alias contribution
is something that will be required much  anyway....


On Wed, 2008-11-26 at 17:42 +0000, Joel Halbert wrote:
> For the time being I'm going to solve the problem by simply hardiwing
> the  charset
> 
> 
> On Wed, 2008-11-26 at 17:35 +0000, Joel Halbert wrote:
> > the problem appears to be related to another conitribution method:
> > 
> > 	public void contributeApplicationDefaults(
> > 			MappedConfiguration<String, String> configuration,
> > 			@Inject
> > 			ApplicationGlobals applicationGlobals,
> > 			@Inject 
> > 			SymbolSource symbolSource
> > 	) {
> > .
> > .
> > 
> > when this is commented out it no longer throws the error, I guess the
> > double dependency on SymbolSource is causing the problem...?
> > 
> > 
> > 
> > On Wed, 2008-11-26 at 09:06 -0800, Howard Lewis Ship wrote:
> > > 5.0.16 introduces much improved logging to the console when this
> > > happens, it should help you diagnost what happened.  What I see looks
> > > correct, but there may be something else going on that we can't see.
> > > 
> > > On Wed, Nov 26, 2008 at 8:58 AM, Joel Halbert <jo...@su3analytics.com> wrote:
> > > > Hi,
> > > >
> > > > I get the following:
> > > >
> > > > "Caused by: java.lang.IllegalStateException: Construction of service
> > > > 'Alias' has failed due to recursion: the service depends on itself in
> > > > some way. Please check
> > > > org.apache.tapestry5.services.TapestryModule.buildAlias(Logger, String,
> > > > AliasManager, Collection) (at TapestryModule.java:217) for references to
> > > > another service that is itself dependent on service 'Alias'."
> > > >
> > > > When contributing the following alias:
> > > >
> > > > public static void contributeAlias(
> > > >        Configuration<AliasContribution<MarkupWriterFactory>>
> > > > configuration,
> > > >        @Inject @Symbol(SymbolConstants.CHARSET) final String
> > > > applicationCharset) {
> > > >
> > > >
> > > > configuration.add(AliasContribution.create(MarkupWriterFactory.class,
> > > >                        new
> > > > XhtmlMarkupWriterFactoryImpl(applicationCharset)));
> > > >        }
> > > >
> > > >
> > > > as per http://wiki.apache.org/tapestry/Tapestry5HowToXhtml
> > > >
> > > >
> > > > I've seen the other threads on this issue but they haven't helped.
> > > >
> > > > Any ideas?
> > > >
> > > > THanks,
> > > > Joel
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > > 
> > > 
> > > 
> > 
> > 
> 
> 


-- 
SU3 Analytics Ltd 
The Print House 
18 Ashwin Street
E8 3DL 
London 

Tel: +44 (0) 20 3051 8637
Fax: +44 (0) 20 8196 2215
Mob: +44 (0) 79 7431 0685 
www.su3analytics.com 

SU3 Analytics Ltd is a company registered in England and Wales under
company number 06639473 at registered address 61b Oxford Gardens, London
W10 5UJ, United Kingdom.


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


Re: T5: Construction of service 'Alias' has failed due to recursion: the service depends on itself in some way. Please check.

Posted by Joel Halbert <jo...@su3analytics.com>.
For the time being I'm going to solve the problem by simply hardiwing
the  charset


On Wed, 2008-11-26 at 17:35 +0000, Joel Halbert wrote:
> the problem appears to be related to another conitribution method:
> 
> 	public void contributeApplicationDefaults(
> 			MappedConfiguration<String, String> configuration,
> 			@Inject
> 			ApplicationGlobals applicationGlobals,
> 			@Inject 
> 			SymbolSource symbolSource
> 	) {
> .
> .
> 
> when this is commented out it no longer throws the error, I guess the
> double dependency on SymbolSource is causing the problem...?
> 
> 
> 
> On Wed, 2008-11-26 at 09:06 -0800, Howard Lewis Ship wrote:
> > 5.0.16 introduces much improved logging to the console when this
> > happens, it should help you diagnost what happened.  What I see looks
> > correct, but there may be something else going on that we can't see.
> > 
> > On Wed, Nov 26, 2008 at 8:58 AM, Joel Halbert <jo...@su3analytics.com> wrote:
> > > Hi,
> > >
> > > I get the following:
> > >
> > > "Caused by: java.lang.IllegalStateException: Construction of service
> > > 'Alias' has failed due to recursion: the service depends on itself in
> > > some way. Please check
> > > org.apache.tapestry5.services.TapestryModule.buildAlias(Logger, String,
> > > AliasManager, Collection) (at TapestryModule.java:217) for references to
> > > another service that is itself dependent on service 'Alias'."
> > >
> > > When contributing the following alias:
> > >
> > > public static void contributeAlias(
> > >        Configuration<AliasContribution<MarkupWriterFactory>>
> > > configuration,
> > >        @Inject @Symbol(SymbolConstants.CHARSET) final String
> > > applicationCharset) {
> > >
> > >
> > > configuration.add(AliasContribution.create(MarkupWriterFactory.class,
> > >                        new
> > > XhtmlMarkupWriterFactoryImpl(applicationCharset)));
> > >        }
> > >
> > >
> > > as per http://wiki.apache.org/tapestry/Tapestry5HowToXhtml
> > >
> > >
> > > I've seen the other threads on this issue but they haven't helped.
> > >
> > > Any ideas?
> > >
> > > THanks,
> > > Joel
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> > 
> > 
> > 
> 
> 


-- 
SU3 Analytics Ltd 
The Print House 
18 Ashwin Street
E8 3DL 
London 

Tel: +44 (0) 20 3051 8637
Fax: +44 (0) 20 8196 2215
Mob: +44 (0) 79 7431 0685 
www.su3analytics.com 

SU3 Analytics Ltd is a company registered in England and Wales under
company number 06639473 at registered address 61b Oxford Gardens, London
W10 5UJ, United Kingdom.


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


Re: T5: Construction of service 'Alias' has failed due to recursion: the service depends on itself in some way. Please check.

Posted by Joel Halbert <jo...@su3analytics.com>.
the problem appears to be related to another conitribution method:

	public void contributeApplicationDefaults(
			MappedConfiguration<String, String> configuration,
			@Inject
			ApplicationGlobals applicationGlobals,
			@Inject 
			SymbolSource symbolSource
	) {
.
.

when this is commented out it no longer throws the error, I guess the
double dependency on SymbolSource is causing the problem...?



On Wed, 2008-11-26 at 09:06 -0800, Howard Lewis Ship wrote:
> 5.0.16 introduces much improved logging to the console when this
> happens, it should help you diagnost what happened.  What I see looks
> correct, but there may be something else going on that we can't see.
> 
> On Wed, Nov 26, 2008 at 8:58 AM, Joel Halbert <jo...@su3analytics.com> wrote:
> > Hi,
> >
> > I get the following:
> >
> > "Caused by: java.lang.IllegalStateException: Construction of service
> > 'Alias' has failed due to recursion: the service depends on itself in
> > some way. Please check
> > org.apache.tapestry5.services.TapestryModule.buildAlias(Logger, String,
> > AliasManager, Collection) (at TapestryModule.java:217) for references to
> > another service that is itself dependent on service 'Alias'."
> >
> > When contributing the following alias:
> >
> > public static void contributeAlias(
> >        Configuration<AliasContribution<MarkupWriterFactory>>
> > configuration,
> >        @Inject @Symbol(SymbolConstants.CHARSET) final String
> > applicationCharset) {
> >
> >
> > configuration.add(AliasContribution.create(MarkupWriterFactory.class,
> >                        new
> > XhtmlMarkupWriterFactoryImpl(applicationCharset)));
> >        }
> >
> >
> > as per http://wiki.apache.org/tapestry/Tapestry5HowToXhtml
> >
> >
> > I've seen the other threads on this issue but they haven't helped.
> >
> > Any ideas?
> >
> > THanks,
> > Joel
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> 
> 
> 


-- 
SU3 Analytics Ltd 
The Print House 
18 Ashwin Street
E8 3DL 
London 

Tel: +44 (0) 20 3051 8637
Fax: +44 (0) 20 8196 2215
Mob: +44 (0) 79 7431 0685 
www.su3analytics.com 

SU3 Analytics Ltd is a company registered in England and Wales under
company number 06639473 at registered address 61b Oxford Gardens, London
W10 5UJ, United Kingdom.


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


Re: T5: Construction of service 'Alias' has failed due to recursion: the service depends on itself in some way. Please check.

Posted by Howard Lewis Ship <hl...@gmail.com>.
5.0.16 introduces much improved logging to the console when this
happens, it should help you diagnost what happened.  What I see looks
correct, but there may be something else going on that we can't see.

On Wed, Nov 26, 2008 at 8:58 AM, Joel Halbert <jo...@su3analytics.com> wrote:
> Hi,
>
> I get the following:
>
> "Caused by: java.lang.IllegalStateException: Construction of service
> 'Alias' has failed due to recursion: the service depends on itself in
> some way. Please check
> org.apache.tapestry5.services.TapestryModule.buildAlias(Logger, String,
> AliasManager, Collection) (at TapestryModule.java:217) for references to
> another service that is itself dependent on service 'Alias'."
>
> When contributing the following alias:
>
> public static void contributeAlias(
>        Configuration<AliasContribution<MarkupWriterFactory>>
> configuration,
>        @Inject @Symbol(SymbolConstants.CHARSET) final String
> applicationCharset) {
>
>
> configuration.add(AliasContribution.create(MarkupWriterFactory.class,
>                        new
> XhtmlMarkupWriterFactoryImpl(applicationCharset)));
>        }
>
>
> as per http://wiki.apache.org/tapestry/Tapestry5HowToXhtml
>
>
> I've seen the other threads on this issue but they haven't helped.
>
> Any ideas?
>
> THanks,
> Joel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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