On 03/22/2011 09:17 AM, Keith Fetterman wrote:
Even after reading all of the help sections on the resin help
documentation, I still find this injection coding rather cryptic. It
looks like the Resin AdminAuthenticator authenticator and our custom
authenticator are conflicting. Any ideas on how I can tell Resin to use
ours instead Resin's would be most helpful.
That's correct. Resin can't figure out which one it's supposed to use
(that may be a Resin bug, because the AdminAuthenticator shouldn't be a
candidate in this case.)
CDI matches based on the type (Authenticator) and some optional
qualifiers or by name. In this case, there's no name or qualifiers, so
Resin can't tell which authenticator to use.
In this case, it might be easiest to give your authenticator a name, and
then assign it directly.
web-app ... xmlns:ee=urn:java:ee
authentication:ApplicationUserAuthenticator ee:Named=myAuth .../
login-config ... authenticator=${myAuth}/
The ee:Named assigns your authenticator a name myAuth.
The authenticator=${myAuth} looks up the name myAuth and assigns the
authenticator.
-- Scott
In our current Web site, which is running resin 3.0.28, we created a
custom Authenticator by extending resin's
com.caucho.server.security.AbstractAuthenticator. In resin 3.0, we used
the following descriptor (under the host tag) in resin.conf:
authenticator
type=com.marinersupply.common.authentication.ApplicationUserAuthenticator
/authenticator
I am moving the site to resin 4.0.16. Following an example in the help,
I converted the descriptor to the following tag under thehost tag:
authentication:ApplicationUserAuthenticator
xmlns:authentication=urn:java:com.marinersupply.common.authentication/
I am getting the following error in the log:
[2011-03-22 07:20:59.461] - ERROR
(com.marinersupply.common.struts.action.DefaultExceptionHandler) -
javax.enterprise.inject.AmbiguousResolutionException: Too many beans
match, because they all have equal precedence. See the @Stereotype
andenable tags to choose a precedence. Beans:
ManagedBeanImpl[AdminAuthenticator, {@com.caucho.config.Admin(),
@javax.inject.Named(value=resinAdmin),
@javax.enterprise.inject.Default(), @Any()}, name=resinAdmin, @Singleton]
ManagedBeanImpl[ApplicationUserAuthenticator, {@Default(), @Any()}]
for InjectManager[web-app:production/webapp/default/ROOT]
javax.enterprise.inject.AmbiguousResolutionException: Too many beans
match, because they all have equal precedence. See the @Stereotype
andenable tags to choose a precedence. Beans:
ManagedBeanImpl[AdminAuthenticator, {@com.caucho.config.Admin(),
@javax.inject.Named(value=resinAdmin),
@javax.enterprise.inject.Default(), @Any()}, name=resinAdmin, @Singleton]
ManagedBeanImpl[ApplicationUserAuthenticator, {@Default(), @Any()}]
for InjectManager[web-app:production/webapp/default/ROOT]
Even after reading all of the help sections on the resin help
documentation, I still find this injection coding rather cryptic. It
looks like the Resin AdminAuthenticator authenticator and our custom
authenticator are conflicting. Any ideas on how I can tell Resin to use
ours instead Resin's would be most helpful.
Also, has anyone found a good tutorial on IOC that explains all of the
annotations and how they effect the beans and their use?
Thanks,
Keith
___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest