I had a set of components I was running the VerifyingVisitor on and was getting the exception:
org.picocontainer.PicoVerificationException: [org.picocontainer.defaults.AmbiguousComponentResolutionException: null has ambiguous dependency on interface java.util.Map, resolves to multiple classes: [class com.genfw.command.wrappers.impl.DefaultAttributeMap, class com.genfw.command.servlet.impl.DefaultEnteredValues]]
at org.picocontainer.defaults.VerifyingVisitor.traverse(VerifyingVisitor.java:56)
at com.genfw.command.servlet.impl.NoWebServerServiceLocatorFactoryTestCase.testGetLocator(NoWebServerServiceLocatorFactoryTestCase.java:28)
The problem I have is that the original component key causing the problem wasn't being included in the stack trace. Putting a break point at VerifyingVisitor 76:
try {
componentAdapter.verify(currentPico);
} catch (RuntimeException e) {
nestedVerificationExceptions.add(e);
}
and grabbing a componentAdapter.toString() in my debugger nabbed the real culprint:
[CachingCA delegate=org.picocontainer.defaults.ConstructorInjectionComponentAdapter[interface com.genfw.command.wrappers.ParameterSource]]
I believe the suspect is probably the AmbiguousComponentResolutionException's getMessage() since the key printed in the stack trace is null – but it could be in the code throwing the AmbiguousComponentResolutionException.