Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345006 - WebDeployableArtifactAdapterFactory is used to handle session and message beans in EJB projects
Summary: WebDeployableArtifactAdapterFactory is used to handle session and message bea...
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.2.3   Edit
Hardware: PC Windows XP
: P1 major (vote)
Target Milestone: 3.2.4   Edit
Assignee: Roberto Sanchez Herrera CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard: PMC
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-06 14:04 EDT by Roberto Sanchez Herrera CLA
Modified: 2011-05-10 22:39 EDT (History)
5 users (show)

See Also:
ccc: pmc_approved? (david_williams)
ccc: pmc_approved? (raghunathan.srinivasan)
ccc: pmc_approved? (naci.dai)
ccc: pmc_approved? (deboer)
neil.hauge: pmc_approved+
kaloyan: pmc_approved+
cbridgha: pmc_approved+
cbridgha: review+


Attachments
Verify that the Beans are in a Web project. If not, return null. (1.05 KB, patch)
2011-05-06 18:11 EDT, Carl Anderson CLA
no flags Details | Diff
Verify that the Beans are in a Web project. If not, return null . Cast Resource to IProject (1.05 KB, patch)
2011-05-10 20:59 EDT, Roberto Sanchez Herrera CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roberto Sanchez Herrera CLA 2011-05-06 14:04:06 EDT
In 3.2.4, bug 339131 introduced a couple of module artifacts adapters to allow WebDeployableArtifactUtil to understand SessionBeans and MessageDrivenBeans, and pass them along to servertools. But these adapters are causing that WebDeployableArtifactAdapterFactory is used for beans in EJB projects also. This is a regression in 3.2.4
Comment 1 Carl Anderson CLA 2011-05-06 16:21:05 EDT
To clarify, this is causing bad information to be passed from the WebDeployableArtifactUtil to the ServerTools code, and prevents proper deployment of EJB 3.x artifacts in an EJB project.  This is a regression from WTP 3.2.3 functionality.

No new module artifact adapters were created, but the existing Web artifact adapters were improved to handle beans in a Web module.  In so doing, the code was made too permissive, and thus it attempts to handle all 3.x beans, and not just those in a Web module.
Comment 2 Carl Anderson CLA 2011-05-06 18:11:52 EDT
Created attachment 194993 [details]
Verify that the Beans are in a Web project.  If not, return null.

Returning null allows the ModuleArtifactAdapter to continue searching until it finds the correct adapter for EJBs in an EJB project.
Comment 3 Chuck Bridgham CLA 2011-05-10 10:04:12 EDT
I agree with this fix - approved
Comment 4 Carl Anderson CLA 2011-05-10 10:14:06 EDT
Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such.

A regression was introduced in the "Run on Server" scenario of 3.x EJBs.  An adopter (IBM) is requesting that the regression be fixed.

Is there a work-around? If so, why do you believe the work-around is insufficient?

There is no work-around.

How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added?

The fix has been tested by hand both at the WTP level and in the adopter product.

Give a brief technical overview. Who has reviewed this fix?

All we did is add a check into WebDeployableArtifactAdapterFactory to ensure the project is a Web project.  As per comment #2 - this change makes it so that the WebDeployableArtifactAdapterFactory returns null for non-Web projects, thus allowing the ModuleArtifactAdapter to continue searching until it finds the correct adapter for EJBs in an EJB project.  Chuck Bridgham, Carl Anderson, and Roberto Sanchez have all reviewed this fix.

What is the risk associated with this fix?

The risk here is relatively low- the change is limited to WebDeployableArtifactAdapterFactory, and only adds one simple check.
Comment 5 Chuck Bridgham CLA 2011-05-10 10:18:18 EDT
I have reviewed this fix - approve.
Comment 6 Neil Hauge CLA 2011-05-10 10:31:08 EDT
Sounds important and is low risk. +1
Comment 7 David Williams CLA 2011-05-10 10:43:14 EDT
Can you clarify explicitly ... this does occur in pure WTP-only, right? Not just adopter use? Similarly, occurs in any server that supports EJBs? Or ... some subset? 

[Sorry if obvious to most ... but, thought it best to ask since not obvious to me.]
Comment 8 Angel Vera CLA 2011-05-10 11:39:52 EDT
Carl, can resource ever be null?
Comment 9 Carl Anderson CLA 2011-05-10 20:37:04 EDT
(In reply to comment #8)
> Carl, can resource ever be null?

resource should never be null.  However, instead of using resource.getProject(), we could certainly just cast resource to be an IProject... then, if it is null, the isDynamicWebProject check will fail (instead of a possible NPE).

That change should be minor enough that we wouldn't need a re-review of the patch.
Comment 10 Roberto Sanchez Herrera CLA 2011-05-10 20:59:31 EDT
Created attachment 195292 [details]
Verify that the Beans are in a Web project.  If not, return null . Cast Resource to IProject
Comment 11 Roberto Sanchez Herrera CLA 2011-05-10 21:04:51 EDT
(In reply to comment #7)
> Can you clarify explicitly ... this does occur in pure WTP-only, right? Not
> just adopter use? Similarly, occurs in any server that supports EJBs? Or ...
> some subset? 
> 
> [Sorry if obvious to most ... but, thought it best to ask since not obvious to
> me.]

David, it happens in WTP alone, but only in conjunction with a Server Adapter that supports EJB 3.x (which we don't ship with WTP.)
Comment 12 Roberto Sanchez Herrera CLA 2011-05-10 22:33:27 EDT
Committed to 3.2_maintenance and HEAD
Comment 13 Roberto Sanchez Herrera CLA 2011-05-10 22:39:50 EDT
(In reply to comment #12)
> Committed to 3.2_maintenance and HEAD

Sorry, I meant R3_2_maintenance and HEAD