--- java/org/apache/catalina/security/SecurityUtil.java (revision 9b4508a3b5b4d5ffe0ca0826904df30915a307b8) +++ java/org/apache/catalina/security/SecurityUtil.java (revision ) @@ -35,6 +35,7 @@ import javax.servlet.http.HttpSession; import org.apache.catalina.Globals; +import org.apache.catalina.comet.CometProcessor; import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.res.StringManager; /** @@ -148,18 +149,22 @@ Principal principal) throws java.lang.Exception{ + // CometProcessor servlets must not be cached as Servlet or NoSuchMethodException will be thrown. + Class targetType = targetObject instanceof CometProcessor ? CometProcessor.class : Servlet.class; + Method method = null; - Method[] methodsCache = classCache.get(Servlet.class); + + Method[] methodsCache = classCache.get(targetType); if(methodsCache == null) { method = createMethodAndCacheIt(methodsCache, - Servlet.class, + targetType, methodName, targetParameterTypes); } else { method = findMethod(methodsCache, methodName); if (method == null) { method = createMethodAndCacheIt(methodsCache, - Servlet.class, + targetType, methodName, targetParameterTypes); } @@ -253,7 +258,7 @@ * Perform work as a particular Subject. Here the work * will be granted to a null subject. * - * @param methodName the method to apply the security restriction + * @param method the method to apply the security restriction * @param targetObject the Servlet on which the method will * be called. * @param targetArguments Object array contains the