You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2008/06/26 08:58:29 UTC

DO NOT REPLY [Bug 45285] New: RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

https://issues.apache.org/bugzilla/show_bug.cgi?id=45285

           Summary: RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED
           Product: Tomcat 6
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Servlet & JSP API
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: divanov@khmb.ru


According to the section EE.5.2.3 of the Java EE specification:
------------------------
Resource annotations may appear on any of the classes listed above, or on any
superclass of any class listed above. A resource annotation on any class in the
inheritance hierarchy defines a resource needed by the application component.
------------------------

I use JSF managed beans with @EJB annotated members.
If a resource is annotated in a super class of a class it's not injected.

Example:

public class Base{
@EJB
private SomeService service;
....
}

public class Child implements Base{
....
}

Base class used as managed bean has 'service' injected.
Child class used as managed bean does NOT have 'service' injected.

If I dare suggest the problem source ...

As I can see org.apache.catalina.util.DefaultAnnotationProcessor is used. It
has the following lines in its  'public void processAnnotations(Object
instance)' method:
....
Field[] fields = instance.getClass().getDeclaredFields();
....
Method[] methods = instance.getClass().getDeclaredMethods();
....


Class.getDeclaredFields method returns 'public, protected, default (package)
access, and private fields, but excludes inherited fields'.

The same thing is with Class.getDeclaredMethods.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45285] RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285


Firstname Lastname <re...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |




--- Comment #4 from Firstname Lastname <re...@yahoo.com>  2008-09-26 08:55:24 PST ---
I downloaded Tomcat 6.0.18 yesterday and tried again.  With the workaround
mentioned in the JSF bug, which is to add the context-param for
injectionProvider, the problem is still there

<context-param>
   <param-name>com.sun.faces.injectionProvider</param-name>
  
<param-value>com.sun.faces.vendor.WebContainerInjectionProvider</param-value>
</context-param>

Your comments indicated that this bug is fixed in 6.0.18.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45285] RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285


Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED




--- Comment #11 from Mark Thomas <ma...@apache.org>  2008-10-27 06:28:44 PST ---
This has been applied to 6.0.x and will be in 6.0.19 onwards.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45285] RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285





--- Comment #5 from Mark Thomas <ma...@apache.org>  2008-09-26 11:06:26 PST ---
Sorry - my bad. The fixed missed the preDestroy and postContruct methods. I'll
get that fixed.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45285] RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285





--- Comment #10 from Mark Thomas <ma...@apache.org>  2008-10-20 02:26:06 PST ---
Thanks for the review and the new patch. I didn't apply the new patch directly
as there were a number of white space changes that made it harder to read. The
proposed patch is
http://people.apache.org/~markt/patches/2008-10-20-bug45285-v2.patch


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 45285] RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285

--- Comment #12 from Jackie Rosen <ja...@hushmail.com> ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45285] RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285





--- Comment #9 from Florent BENOIT <fl...@objectweb.org>  2008-10-15 08:49:41 PST ---
Created an attachment (id=22739)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22739)
binary of the patch

For people without compiling env, here is the class


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45285] RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285


Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |removeps-code@yahoo.com




--- Comment #3 from Mark Thomas <ma...@apache.org>  2008-09-24 05:18:40 PST ---
*** Bug 45869 has been marked as a duplicate of this bug. ***


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 45285] RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285

Richard.Cheney@eu.sony.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Richard.Cheney@eu.sony.com

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45285] RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285





--- Comment #8 from Florent BENOIT <fl...@objectweb.org>  2008-10-15 08:48:16 PST ---
Created an attachment (id=22738)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22738)
Updated patch for fields/methods

I notice that the fix that was done by Mark wasn't right also for
attributes/methods.

Because even if we go in the upper classes with a loop, when checking the
field/methods we were using instance.getClass() and not the clazz object so
fields/methods of superclasses were never obtained.

Also the default name for ENC field/methods should contain the super class name
and not the instance name, so I added the clazz parameter to the lookup
methods.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45285] RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285





--- Comment #7 from Firstname Lastname <re...@yahoo.com>  2008-10-14 11:57:27 PST ---
Thanks for the patch.  I don't have the compile environment, so will just close
verify the bug in the next build.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45285] RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285





--- Comment #6 from Florent BENOIT <fl...@objectweb.org>  2008-10-14 09:56:40 PST ---
Created an attachment (id=22728)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22728)
postConstruct/preDestroy in super classes

Here is a patch that is fixing this issue for postConstruct/preDestroy methods
in super classes (private)


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45285] RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285





--- Comment #1 from Mark Thomas <ma...@apache.org>  2008-07-09 14:07:06 PST ---
A fix has been committed to trunk and proposed for 6.0.x


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45285] RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285


Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #2 from Mark Thomas <ma...@apache.org>  2008-07-13 11:20:51 PST ---
This has been fixed in 6.0.x and will be included in 6.0.18 onwards.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org