Created attachment 24222[details]
Patch file contatining the proposed fix
When a webapp is stopped in tomcat, the annotationProcessor field does not get
nullified. When the webapp is started again, the start() method of the
StandardContext class checks whether the annotationProcessor field is null, and
only builds a new one if so. This means that the annotationProcessor gets
reused between application start/stop cycles (not tomcat restart cycles).
Things that are dependent on the annotationProcessor (like injection, etc) may
be broken because of this.
One specific example is when using OpenEJB tomcat integration. The
annotationProcesor itself holds a reference to a javax.naming.Context, which is
cached between context start/stop cycles. This causes that after a stop/start
cycle of a context, the annotationProcessor tries to inject the EJB reference
proxies made at the first start of the context, which was made against
different instances of the to-be-injected fields' classes. This results that
the EJB injection is not working.
Other types of injections may be broken too.
Attached patch file containing the fix. Tested, works.

This is ASF Bugzilla: the Apache Software Foundation bug system. In case
of problems with the functioning of ASF Bugzilla, please contact
bugzilla-admin@apache.org.
Please Note: this e-mail address is only for reporting problems
with ASF Bugzilla. Mail about any other subject will be silently
ignored.