Bug 947494 - EJB 3.0 injection - wrong beanName and still get injection
Summary: EJB 3.0 injection - wrong beanName and still get injection
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: JBoss Enterprise Application Platform 5
Classification: JBoss
Component: jbossas
Version: 5.1.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: jboss-set
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-04-02 14:55 UTC by Luan Cestari
Modified: 2025-02-10 03:27 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-02-10 03:27:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Brad example (11.85 KB, application/zip)
2013-04-02 14:58 UTC, Luan Cestari
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker EJBTHREE-2301 0 Major Open EJB 3.0 injection - wrong beanName and still get injection 2016-03-29 08:20:55 UTC

Description Luan Cestari 2013-04-02 14:55:44 UTC
Description of problem:
I got a case [1] that seems to be a bug. The scenario is: a class have some fields that have different implementations of the declared interface and the client use the beanName/name attribute to tell which one he want. This works fine, but the customer change a beanName/name of an annotated field (by mistake) to something wrong and he didn't got any message from the container saying about the unresolved EJB reference, instead he noticed that the container randomly inject a bean in that field (and we the method was invoked he got some issues due didn't happened hat he expected). So, my question is, is is right expecting the container sending a message to this case? I saw the JSR 220 [2] and I think it is. Some parts of the specification:

16.5.3 Deployer’s Responsibility
If an EJB annotation includes the beanName element or the reference declaration includes the
ejb-link element, the Deployer should bind the enterprise bean reference to the enterprise
bean specified as the target.

16.5.4 Container Provider’s Responsibility
The Container Provider must provide the deployment tools that allow the Deployer to perform the tasks
described in the previous subsection. The deployment tools provided by the EJB Container Provider
must be able to process the information supplied in the ejb-ref and ejb-local-ref elements in
the deployment descriptor.
At the minimum, the tools must be able to:
• Preserve the application assembly information in annotations or in the ejb-link elements
by binding an EJB reference to the business interface or the home interface of the specified target bean.
• Inform the Deployer of any unresolved EJB references, and allow him or her to resolve an EJB
reference by binding it to a specified compatible target bean.
[1] 00804385 - https://c.na7.visual.force.com/apex/Case_View?id=500A000000DMyuD&sfdc.override=1
[2] JSR 220 - http://download.oracle.com/otndocs/jcp/ejb-3_0-fr-eval-oth-JSpec/
  
Actual results:
Container give any implementation of the interface.

Expected results:
Raise an exception during the deploy/lookup for wrong beanName/name using @EJB

Additional info:
attaching a reproducer made by Brad

Comment 1 Luan Cestari 2013-04-02 14:58:21 UTC
Created attachment 730822 [details]
Brad example

Comment 11 Red Hat Bugzilla 2025-02-10 03:27:38 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.


Note You need to log in before you can comment on or make changes to this bug.