This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 201825 - suspicious messages for @Injection
Summary: suspicious messages for @Injection
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: CDI (show other bugs)
Version: 7.1
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Denis Anisimov
URL:
Keywords:
: 205914 208335 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-09-08 14:17 UTC by muellermi
Modified: 2012-02-13 13:26 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description muellermi 2011-09-08 14:17:28 UTC
Product Version = NetBeans IDE Dev (Build 201109060600)
Operating System = Windows XP version 5.1 running on x86
Java; VM; Vendor = 1.7.0
Runtime = Java HotSpot(TM) Client VM 21.0-b17

  @Inject private Conversation _conversation;
false NetBeans warning: Unsatisfied dependency: no bean matches the injection point
off course there is no bean, but it's a valid injection


    @Inject
    private SessionController _sessionController;
false NetBeans warning: No enabled eligible for injection beans are found
The bean is a named session bean, thus it is eligible
Comment 1 Denis Anisimov 2011-10-05 15:48:10 UTC
(In reply to comment #0)
> Product Version = NetBeans IDE Dev (Build 201109060600)
> Operating System = Windows XP version 5.1 running on x86
> Java; VM; Vendor = 1.7.0
> Runtime = Java HotSpot(TM) Client VM 21.0-b17
> 
>   @Inject private Conversation _conversation;
> false NetBeans warning: Unsatisfied dependency: no bean matches the injection
> point
> off course there is no bean, but it's a valid injection
Why it is valid injection ?
Please describe it in details.
> 
> 
>     @Inject
>     private SessionController _sessionController;
> false NetBeans warning: No enabled eligible for injection beans are found
> The bean is a named session bean, thus it is eligible
Also don't see details.
What is the SessionController  ?
Comment 2 Denis Anisimov 2011-10-06 05:29:46 UTC
OK, the Conversation is the javax.enterprise.context.conversation.Conversation interface with @Default qualifier and @RequestScoped.
By the CDI spec its built-in type which is provided by the container. 
So there could be no explicitly enabled bean.
CDI warnings should ignore such injection.
I will fix it.

Still has no information what is SessionController .
What is FQN, its Java type definition , what qualifiers it has . Is it class in 
compile classpath or in the source ?
I can't realize the problem without this information.
Comment 3 Denis Anisimov 2011-10-06 06:14:38 UTC
(In reply to comment #2)
> OK, the Conversation is the javax.enterprise.context.conversation.Conversation
> interface with @Default qualifier and @RequestScoped.
The CDI spec lies about the scope.
So it seems this is the truth:
Conversation is the javax.enterprise.context.Conversation.
It's name javax.enterprise.context.conversation.
And it has @ConversationScoped scope. 
This is from JavaDoc.

The spec tells that it has @Default qualifier and it has @RequestScoped scope.
The last thing is false I think.
Comment 4 Denis Anisimov 2011-10-06 07:14:04 UTC
Fix for Conversation and Context interfaces :
web-main#6971324f5d17
Comment 5 Denis Anisimov 2011-10-06 07:18:56 UTC
Additional information from reporter :
SessionController has definition 

@Named
@SessionScoped
public class SessionController implements Serializable {

I'm able to reproduce it.
Will investigate.
Comment 6 Denis Anisimov 2011-10-06 07:29:54 UTC
1) SessionController has @SessionScoped scope. The last scope is a normal scope.
It means that controller requires create a proxy for required type.
2) You are using SessionController as REQUIRED TYPE for injection point.
This is a class which means it has all methods inherited from Object class which 
has a number of final methods. 
Final methods cannot be proxied. That's why SessionController eligible for injection element BUT it is disabled. You can realize it via Inspect CDI action.

This is by the CDI spec.
So this is not an issue.
To resolve your problem one needs to refactor interface from SessionController .
This interface should set as required type in injection.
Comment 7 Quality Engineering 2011-10-07 14:37:31 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/6971324f5d17
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for built-in scope bean types : Context and Conversation , BZ#201825 - suspicious messages for @Injection
Comment 8 Denis Anisimov 2011-12-06 08:36:56 UTC
*** Bug 205914 has been marked as a duplicate of this bug. ***
Comment 9 dorssel 2012-01-13 10:37:14 UTC
Injections with a normal scoped bean *class* as REQUIRED TYPE are allowed by the CDI spec, and they are proxyable. Denis is probably referring to section 5.4.1 "Unproxyable bean types" where it says "classes which are declared final or have final methods". However, from the next section it is clear that the final methods of java.lang.Object are excluded:

"5.4.2. Client proxy invocation
...
The behavior of all methods declared by java.lang.Object, except for toString(), is undefined for a client proxy. Portable applications should not invoke any method declared by java.lang.Object, except for toString(), on a client proxy."

This type of injection is similar to the no-interface view injection of EJB 3.0.

So to resolve this issue the trigger for this warning should exclude the final methods of Object.
Comment 10 Denis Anisimov 2012-01-13 10:40:16 UTC
OK, agreed.
Thanks for clarification.
Comment 11 Denis Anisimov 2012-01-13 11:04:32 UTC
web-main#559756a3542a
Comment 12 Quality Engineering 2012-01-15 16:08:27 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/559756a3542a
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#201825 - suspicious messages for @Injection
Comment 13 doozer 2012-01-24 16:43:23 UTC
I'm injecting a bean marked with @Named and @ConversationScoped but I'm using the CODI conversation scope type: org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationScoped

The warning I'm seeing is since upgrading to NB7.1 is: "No enabled eligible for injection beans are found"

I realize it's not a built in scope but this is a valid injection as far as I can tell (the application works fine) so I'd rather not be seeing a warning if possible.
Comment 14 sebastianovide 2012-01-24 17:15:52 UTC
(In reply to comment #13)
> I'm injecting a bean marked with @Named and @ConversationScoped but I'm using
> the CODI conversation scope type:
> org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationScoped
> 
> The warning I'm seeing is since upgrading to NB7.1 is: "No enabled eligible for
> injection beans are found"
> 
> I realize it's not a built in scope but this is a valid injection as far as I
> can tell (the application works fine) so I'd rather not be seeing a warning if
> possible.

same here: 

@Inject
ConfigHelper config;

and ConfigHelper is

@Named
@ApplicationScoped
public class ConfigHelper implements Serializable{
Comment 15 Denis Anisimov 2012-01-25 06:28:06 UTC
ApplicationScoped, org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationScoped
and originally reported RequestScoped are Normal scopes ( see CDI spec ).
So this bug is the same for any of them.

The bug is FIXED.
It is fixed in the 7.2.
Use the development build for check the fix.
Comment 16 Denis Anisimov 2012-02-13 13:26:54 UTC
*** Bug 208335 has been marked as a duplicate of this bug. ***