@Resource does not work if stated in the parent class
I have created a base class to handle my REST web services:
public abstract class RestHandler implements Provider
@Resource protected WebServiceContext wsContext;
/** Creates a new instance of RestHandler */
public Source invoke(Source source)
// implementation goes here
and subclasses of it
public class RepositoryRest extends RestHandler
@Resource protected WebServiceContext wsContext2;
/** Creates a new instance of Repository */
The problem is that @Resource in RestHandler is not been triggered when JAX-WS instantiates subclasses of RestHandler. I am getting a null value in the wsContext object.
As per @Resource documentation ( http://184.108.40.206/javaee/5/docs/api/javax/annotation/Resource.html ), "Even though this annotation is not marked Inherited, deployment tools are required to examine all superclasses of any component class to discover all uses of this annotation in all superclasses. All such annotation instances specify resources that are needed by the application component. Note that this annotation may appear on private fields and methods of superclasses; the container is required to perform injection in these cases as well."
Apparently this problem has been fixed for EJB injection:
Has anyone found a solution for this problem? Is it really a bug?