Tapestry is doing exactly what you told it, just not what you want.
Your implementation has it own id (you see it in the exception). However, it's type overlaps the built-in ClientPersistentFieldStorage class. When Tapestry tries to resolve the injection by that type, it sees both services. The solution is to choose one and contribute it into the Alias or AliasOverrides service configuration. i.e. public static void contributeAlias(Configuration<AliasContribution> configuration, ObjectLocator locator, @InjectService("ComponentClassFactory") ClassFactory componentClassFactory, @InjectService("DefaultDataTypeAnalyzer") DataTypeAnalyzer dataTypeAnalyzer) { add(configuration, locator, ComponentEventResultProcessor.class, ObjectRenderer.class); configuration.add(AliasContribution.create(ClassFactory.class, componentClassFactory)); configuration.add(AliasContribution.create(DataTypeAnalyzer.class, dataTypeAnalyzer)); } (this is from TapestryModule). Here you inject using an explicit service id. On 5/21/07, Jun Tsai <[EMAIL PROTECTED]> wrote:
public static void bind(ServiceBinder binder){ binder.bind(MyPersistentFieldStorageImpl.class ).withId("MyPersistentFieldStrategy"); } public class MyPersistentFieldStorageImpl extends ClientPersistentFieldStorageImpl exception: Service interface org.apache.tapestry.internal.services.ClientPersistentFieldStorage is matched by 2 services: ClientPersistentFieldStorage, MyPersistentFieldStrategy. Automatic dependency resolution requires that exactly one service implement the interface. -- Welcome to China Java Users Group(CNJUG). http://cnjug.dev.java.net --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com