[
https://jira.jboss.org/jira/browse/JBSEAM-4247?page=com.atlassian.jira.pl...
]
Matthew Bowman commented on JBSEAM-4247:
----------------------------------------
The log shows 'registering provider as Seam component: serviceExceptionMapper'
however it is never actually registered.
I traced it to
org.jboss.resteasy.spi.ResteasyProviderFactory.addExceptionMapper(ExceptionMapper):
{code}
public void addExceptionMapper(ExceptionMapper provider)
{
providers.put(provider.getClass(), provider);
PropertyInjectorImpl injector = new PropertyInjectorImpl(provider.getClass(),
this);
injector.inject(provider);
Type[] intfs = provider.getClass().getGenericInterfaces();
for (Type type : intfs)
{
if (type instanceof ParameterizedType)
{
ParameterizedType pt = (ParameterizedType) type;
if (pt.getRawType().equals(ExceptionMapper.class))
{
exceptionMappers.put(Types.getRawType(pt.getActualTypeArguments()[0]),
provider);
}
}
}
}
{/code}
In short, when it queries the provider class' generic interfaces, the Type[] array
returned is that of the proxy and not the Seam component itself. Therefore, the check of
"type instanceof ParameterizedType" never succeeds. In other words, it
doesn't see the "... implements ExceptionMapper<E>" on the provider
and hence is never actually added to the exceptionMappers map.
Hope this helps.
Seam managed @Provider not registered
-------------------------------------
Key: JBSEAM-4247
URL:
https://jira.jboss.org/jira/browse/JBSEAM-4247
Project: Seam
Issue Type: Bug
Components: WS
Affects Versions: 2.1.2.GA
Reporter: Matthew Bowman
Assignee: Christian Bauer
Attachments: resteasy-debug.log
Example:
@Name("serviceExceptionMapper")
@Scope(ScopeType.APPLICATION)
@Provider
public class ServiceExceptionMapper implements ExceptionMapper<ServiceException> {
public Resposne toResponse(ServiceException ex) {
return Response.noContent().build();
}
}
This custom ExceptionMapper provider will not be registered with ResteasyProviderFactory.
If I remove the @Name + @Scope annotations, the provider is registered.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira