WLS 12.1.1 -ServletContainerInitializer Doesn't Find @HandlesTypes Classes Unless Directly Extended

(Doc ID 1665019.1)

Last updated on JUNE 09, 2016

Applies to:

Oracle WebLogic Server - Version and later
Information in this document applies to any platform.


Using the Servlet 3.0 feature of creating a javax.servlet.ServletContainerInitializer,the javax.servlet.annotation.HandlesTypes annotation allows you to indicate which classes on the classpath to pass into the public void onStartup(final Set<Class> c, final ServletContext ctx) method. If we specify @HandlesType(MyHandledInterface.class),any class that directly implements MyHandledInterface will be provided to onStartup(c, ctx).

However,if we introduce an abstract class named AbstractHandledClass (for example) that implements MyInterface, and then create another class named MyHandledClass that extends AbstractHandledClass, MyHandledClass will not be provided in the set of classes given to onStartup(c, ctx).The set of class (named c) will contain AbstractMyHandledClass, but it will not contain MyHandledClass.

Ideally we would expect MyHandledClass to be included in the set of classes because it does, in fact, implement MyInterface. It just does not implement it directly.But we notice on WLS 12.1.2 that MyHandledClass is not being provided in the set of classes given to onStartup(c, ctx)


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms