Well, I've been staring at what comes back as a web page with stack traces
and it hasn't been
all that helpful. The class that things get traced back to absolutely does
an @InjectService("one").
And I've restarted Eclipse, recompiled the associated project, and verified
that I wasn't picking up
a stale class (at least I think I have been, but I've been fooled before).

Or is there a different "console log" that you're referring to?

Erick

On Mon, May 24, 2010 at 4:42 PM, Howard Lewis Ship <hls...@gmail.com> wrote:

> Let Tapestry do the work for you; as it instantiates services and
> other objects, it logs what it's doing; it should be able to point you
> right at the class (and even line number) of the errant injection.
> Read the console log.
>
> On Mon, May 24, 2010 at 1:19 PM, Erick Erickson <erickerick...@gmail.com>
> wrote:
> > Howard:
> >
> > Thanks for your answer, but I sure don't see where we're injecting by
> > the type, but that may just mean I need to look harder. Maybe somewhere
> > we're providing a builder or something.
> >
> > But just for clarification, you're saying that I should NOT need to do
> the
> > ContributeAlias bit to resolve the bind().withId("one") if all the
> Tapestry
> > injections
> > of the service are annotated wtih @InjectService("one")?
> >
> > I guess my next step is to see just how much stuff I can remove before
> > things
> > "just work". If I get it back to what looks like a test program I'll let
> you
> > know.
> >
> > Thanks
> > Erick
> >
> >
> >
> > On Mon, May 24, 2010 at 3:06 PM, Howard Lewis Ship <hls...@gmail.com>
> wrote:
> >
> >> You should only be getting this error:
> >>
> >> Service interface  CommonInterface is matched by 2 services: one, two.
> >> Automatic dependency resolution requires that exactly one service
> implement
> >> the interface.
> >>
> >>
> >> if you are injecting somewhere by type (CommonInterface) rather than
> >> service id.  The console log will tell you exactly how Tapestry got to
> >> that point.
> >>
> >> On Mon, May 24, 2010 at 11:32 AM, Shing Hing Man <mat...@yahoo.com>
> wrote:
> >> > I think you need the Marker annotations.
> >> > Please check it out at the link below.
> >> >
> >> > http://tapestry.apache.org/tapestry5.1/tapestry-ioc/service.html
> >> >
> >> >
> >> >
> >> > Shing
> >> >
> >> > --- On Tue, 25/5/10, Erick Erickson <erickerick...@gmail.com> wrote:
> >> >
> >> >> From: Erick Erickson <erickerick...@gmail.com>
> >> >> Subject: Problems with @InjectService
> >> >> To: "Tapestry users" <users@tapestry.apache.org>
> >> >> Date: Tuesday, 25 May, 2010, 1:58
> >> >> I've seen several iterations of this
> >> >> problem in the users list, but the
> >> >> solution still eludes me.
> >> >>
> >> >> This is the very basic issue of having two different
> >> >> concrete realizations
> >> >> of a particular interface and wanting to have a service for
> >> >> each concrete
> >> >> implementation in a Tapestry 1.5.0.5 environment.
> >> >>
> >> >> The binding looks like this:
> >> >>
> >> >>
> >> >> binder.bind(CommonInterface.class,
> >> >> Concrete1.class).withId("one");
> >> >>
> >> >> binder.bind(CommonInterface.class,
> >> >> Concrete2.class).withId("two");
> >> >>
> >> >> And in various components, something like
> >> >> @InjectService("one")
> >> >> private CommonInterface concrete1;
> >> >>
> >> >> or
> >> >> @InjectService("two")
> >> >> private CommonInterface concrete2;
> >> >>
> >> >> But now I get errors like:
> >> >> Service interface  CommonInterface is matched by 2
> >> >> services: one, two.
> >> >> Automatic dependency resolution requires that exactly one
> >> >> service implement
> >> >> the interface.
> >> >>
> >> >> OK, poking around I found things about ContributeAlias, and
> >> >> this example:
> >> >> public static void contributeAlias(
> >> >> @InjectService("one") Concrete1 concrete1
> >> >> Configuration<AliasContribution> configuration)
> >> >> {
> >> >> configuration.add(AliasContribution.create(CommonInterface.class,
> >> >> concrete1));
> >> >> }
> >> >>
> >> >> and similarly for Concrete2. But now I get errors like:
> >> >> Caused by: java.lang.RuntimeException: Exception
> >> >> constructing service
> >> >> 'Alias': Error invoking service builder method
> >> >> org.apache.tapestry5.services.TapestryModule.buildAlias(Logger,
> >> >> String,
> >> >> AliasManager, Collection) (at TapestryModule.java:325)....
> >> >>
> >> >>             Service 'one'
> >> >> implements interface
> >> >> CommonInterface, which is not compatible with the requested
> >> >> type
> >> >> 'concrete1'.
> >> >> at
> >> >>
> >>
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:78)
> >> >> at
> >> >>
> >>
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57)
> >> >>
> >> >>
> >> >> I've severely clipped out extra stuff from the output, I'll
> >> >> be glad to
> >> >> provide more details but I suspect this is fairly trivial
> >> >> to fix if you know
> >> >> the magic, unfortunately I'm an apprentice...
> >> >>
> >> >> I don't understand when adding ContributeAlias is
> >> >> necessary, it seems to me
> >> >> that just the "withId" should be sufficient but what do I
> >> >> know?
> >> >>
> >> >> Thanks
> >> >> Erick
> >> >>
> >> >
> >> >
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > 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
> >>
> >>
> >
>
>
>
> --
> 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
>
>

Reply via email to