Anonymous | Login | Signup for a new account | 12-17-2024 10:57 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Advanced Details [ Jump to Notes ] | [ View Simple ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0000952 | [Resin] | minor | always | 02-20-06 08:51 | 03-27-06 14:53 | ||||
Reporter | anonymous | View Status | public | ||||||
Assigned To | ferg | ||||||||
Priority | normal | Resolution | fixed | Platform | |||||
Status | closed | OS | |||||||
Projection | none | OS Version | |||||||
ETA | none | Fixed in Version | 3.0.19 | Product Version | 3.0.16 | ||||
Product Build | |||||||||
Summary | 0000952: @EJB injection and inheritance | ||||||||
Description |
The @EJB injection code is not handling annotations specified in a base class. I have a little code I have been playing with where I have a series of servlets derived from a custom base class. The base class contains a reference to an EJB that all of my servlets need. I tried to configure this by adding an @EJB method in the base class but the injection never happens. I found two workarounds for now: - Do the injection from each derived class. Then things work correctly, but I end up with a lot of duplicate code. - Manually do the lookup in init() of the base class. |
||||||||
Steps To Reproduce | |||||||||
Additional Information |
Example: public class BaseServlet extends ... { protected MyEJB ejb = null; ... @EJB public void setMyEJB(MyEJB ejb) ... } public class ConcreteServlet extends BaseServlet { ... public void service(...) { this.ejb.method(); // NPE here - injection is not being done } ... } WORKAROUND: Do the injection from the concrete class rather than the base class public class ConcreteServlet extends BaseServlet { ... @EJB public void setMyEJB(MyEJB ejb) { ... } ... public void service(...) { this.ejb.method(); // Works fine now... } } |
||||||||
Attached Files | |||||||||
|
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed. 25 unique queries executed. |