Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 324225 - ClassCastException when trying to open EJB reference
Summary: ClassCastException when trying to open EJB reference
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows Vista
: P2 normal (vote)
Target Milestone: 3.2.3   Edit
Assignee: Dimitar Giormov CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-01 12:38 EDT by Kaloyan Raev CLA
Modified: 2011-01-29 12:38 EST (History)
4 users (show)

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


Attachments
exception (3.07 KB, text/plain)
2010-09-01 12:38 EDT, Kaloyan Raev CLA
no flags Details
Patch (6.74 KB, patch)
2011-01-13 07:32 EST, Vladislav Iliev CLA
no flags Details | Diff
Patch (8.82 KB, patch)
2011-01-14 05:06 EST, Vladislav Iliev CLA
dimitar.giormov: iplog+
Details | Diff
cleaned up commented code + backup plan for application client project. (7.82 KB, patch)
2011-01-14 07:12 EST, Dimitar Giormov CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kaloyan Raev CLA 2010-09-01 12:38:44 EDT
Created attachment 177985 [details]
exception

Reproducible on latest 3.2.2 and 3.3 builds. 

Steps to reproduce:
  1. Create new Web 2.5 project.
  2. Create new EJB 3.0 project. 
  3. Create new EAR 5 project and include the Web and EJB project created above. 
  4. Create new Session Bean in the EJB project. 
  5. Create new Servlet in the Web project. 
  6. Create a reference in the Servlet to the Session Bean - using @EJB in the Java code. 
  7. Expand the DD tree of the Web project > References. 
  8. Double-click on the reference. 

The following ClassCastException is thrown: 

org.eclipse.jst.javaee.web.internal.impl.WebAppImpl cannot be cast to org.eclipse.jst.javaee.ejb.EJBJar

Full exception log is attached.
Comment 1 Carl Anderson CLA 2010-09-02 08:20:43 EDT
This is a regression from WTP 3.2.0.  It was caused by bug 260705
Comment 2 Vladislav Iliev CLA 2011-01-13 07:32:12 EST
Created attachment 186716 [details]
Patch

This is a proposal for a patch.
Please check it.
Comment 3 Dimitar Giormov CLA 2011-01-13 10:53:28 EST
Vladislav, can you rework a little bit the patch.
1. Purely cosmetic, but remove the commented out code.
2. In the code you are checking for existing Resource reference, but in the list with Ejb references. (patch line 320)
Comment 4 Vladislav Iliev CLA 2011-01-14 05:06:55 EST
Created attachment 186809 [details]
Patch

Second version of the previously proposed patch.
Comment 5 Dimitar Giormov CLA 2011-01-14 07:12:50 EST
Created attachment 186819 [details]
cleaned up commented code + backup plan for application client project.
Comment 6 Chuck Bridgham CLA 2011-01-25 14:32:49 EST
approve
Comment 7 Dimitar Giormov CLA 2011-01-26 02:51:34 EST
Dear PMC members,

This bug causes the eclipse to open error dialog on double click in the case where a EJB reference is selected in Dynamic Web Project. The correct behavior is to open the class where the reference is defined using annotation, or to open the web.xml 
There is a workaround: find the reference you will need manually - search in the classes or the web.xml or both.
The fix is tested manually. Chuck has reviewed the change.
Risk: Low

Technical details:
The fix differentiates the ejb and web projects and artifacts and applies the same logic for both: 1. Check if the reference comes from xml if true opens the appropriate xml file, if false checks in which class the reference is defined and opens this class.
Comment 8 David Williams CLA 2011-01-27 15:16:30 EST
Note: this bug did not have 'PMC' in whiteboard, so has not shown up on review list and has gone unnoticed ... until Carl's watchful eye. I've update the whiteboard and will approve so (hopefully) Carl can release for our RC2.
Comment 9 Carl Anderson CLA 2011-01-27 15:19:05 EST
Committed to R3_2_maintenance for WTP 3.2.3 RC2