Hi there,
using Shiro along with "JBoss RESTeasy" for fast rest-based
web-application development I'm running into some mysterious
NullPointerExceptions :-/
Example-Code:
----------
@POST
@Path("/{contactType}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@RequiresUser
public static Response createContact(@PathParam("contactType") String
contactType, String request)
{
// do something
}
----------
Sending an POST-Request to the site produces the following Exception:
----------
[...]
Caused by: java.lang.NullPointerException
at
org.apache.shiro.aop.DefaultAnnotationResolver.getAnnotation(DefaultAnno
tationResolver.java:62)
at
org.apache.shiro.aop.AnnotationMethodInterceptor.getAnnotation(Annotatio
nMethodInterceptor.java:148)
at
org.apache.shiro.aop.AnnotationMethodInterceptor.supports(AnnotationMeth
odInterceptor.java:134)
at
org.apache.shiro.authz.aop.AnnotationsAuthorizingMethodInterceptor.asser
tAuthorized(AnnotationsAuthorizingMethodInterceptor.java:99)
at
org.apache.shiro.authz.aop.AuthorizingMethodInterceptor.invoke(Authorizi
ngMethodInterceptor.java:38)
at
org.apache.shiro.aspectj.AspectjAnnotationsAuthorizingMethodInterceptor.
performBeforeInterception(AspectjAnnotationsAuthorizingMethodInterceptor
.java:61)
at
org.apache.shiro.aspectj.ShiroAnnotationAuthorizingAspect.executeAnnotat
edMethod(ShiroAnnotationAuthorizingAspect.java:52)
----------
Looking into org.apache.shiro.aop.DefaultAnnotationResolver at line 62:
return annotation == null ? mi.getThis().getClass().getAnnotation(clazz)
: annotation;
So the only possible source of the NullPointer seems to be
"mi.getThis()" for me...
Any suggestions how to avoid and/or solve this?
Greets,
Christian Scharr