This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 245645 - Ejb 3.0 project can not reference a class in the ejb client project
Summary: Ejb 3.0 project can not reference a class in the ejb client project
Status: CLOSED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 3.0.2   Edit
Assignee: Jason Sholl CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-29 03:58 EDT by kiril mitov CLA
Modified: 2008-09-07 04:43 EDT (History)
5 users (show)

See Also:
ccc: review+


Attachments
screenshot (30.47 KB, image/png)
2008-09-02 15:45 EDT, Jason Sholl CLA
no flags Details
temporary patch (2.96 KB, patch)
2008-09-03 10:34 EDT, Jason Sholl CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kiril mitov CLA 2008-08-29 03:58:43 EDT
Executing smoke test for build
http://build.eclipse.org/webtools/committers/wtp-R3.0-M/20080828055051/M-3.0.2-20080828055051/ 

Smoke test located at 
http://wiki.eclipse.org/WTP_Smoke_Test_Results_R302_082808 

1.Set up the environment as described in the test.
2.Create a new EJB 3.0 project.
3.Create a new Session Bean in the project as described in the smoke test.

Problem: The session bean can not be compiled. Its local interface is located in the client project. JDT reports an error "TestBeanLocal can not be resolved to a Type"

Note:The ejb client project is listed in the Java EE Module Dependencies page of the ejb project.
Comment 1 Kaloyan Raev CLA 2008-08-29 04:02:45 EDT
This problem was not observed with official 3.0.1 and 3.1 M1 releases. Therefore, it is seems to be introduced with some changes to the class path dependencies made this week. 
Comment 2 Kaloyan Raev CLA 2008-08-29 04:05:57 EDT
One clarification on reproducing: in the smoke test we create the EJB as added to an EAR. This way the EJB project is created together with an EJB Client project.
Comment 3 David Williams CLA 2008-09-02 01:45:00 EDT
For cross reference, see also bug 245597 
Comment 4 Chuck Bridgham CLA 2008-09-02 09:20:23 EDT
Jason please take a look.
Comment 5 Jason Sholl CLA 2008-09-02 14:30:13 EDT
This seems like a similar problem as bug 245426 where JDT is not ready.  Bug 245426 is not the problem however.  Using the context menu action Java EE Tools -> Update EAR Libraries will force the EAR Libraries context menu to update.

Also, this can be easily reproduced simply using regular java classes.  Just try referencing any class from the EJB project to the client project, it will not compile.
Comment 6 Jason Sholl CLA 2008-09-02 15:40:22 EDT
Jerome,

I'm hoping you might be able to add some insight.  I'm not sure what is going wrong; I'm attaching a screenshot showing the failure.  The project 'Test' contains a class 'test.B' which extends class 'test.A'.  Class 'test.A' is in project 'TestClient'.  Project 'Test' references project 'TestClient' via the 'EAR Libraries' classpath container.  

I've been stepping through the EAR Libraries classpath container code, and it appears to be properly including the TestClient project, and the UI reflects this.  However, the JDT internals contradict this because of the compilation errors.

This only appears to happen the first time these projects are created.  Manually removing and readding the classpath container fixes the problem.  Using an action we added to force the re computation of the container also fixes the problem.  So does restarting the workspace and performing a clean.
Comment 7 Jason Sholl CLA 2008-09-02 15:45:10 EDT
Created attachment 111519 [details]
screenshot

Screenshot showing the entry, yet JDT does not compile.
Comment 8 Jason Sholl CLA 2008-09-02 16:33:10 EDT
Looks like bug 244086 is the problem here that introduced this.  Not sure why, though.  Still seems there is a JDT bug here somewhere.
Comment 9 David Williams CLA 2008-09-02 18:00:20 EDT
Maybe this is obvious to you, but seems my first question is which is worse, bug 244086 or this bug? If this bug is worse, should we just revert bug 244086? Until a better fix is available, that is? 

Thanks, 
Comment 10 Jerome Lanneluc CLA 2008-09-03 07:08:39 EDT
(In reply to comment #6)
Jason, it is hard to tell but here are things to explore:
1. is the classpath container really initializing correctly on the first call? ie. does it call setContainer and does it provide all classpath entries on the first initialize?
2. is there any side effect done by a builder? e.g. the referered project is created by the builder
3. is there a timing issue? i.e. do you still see the problem if you put a breakpoint in your initializer and run under debug?

Comment 11 Jason Sholl CLA 2008-09-03 10:33:51 EDT
In reply to comment #9 yes, reverting bug 244086 would be best for the short term.  Only the change related to the DependencyGraphImpl is needed.
Comment 12 Jason Sholl CLA 2008-09-03 10:34:31 EDT
Created attachment 111584 [details]
temporary patch

The above described temporary patch.
Comment 13 Jason Sholl CLA 2008-09-03 10:40:18 EDT
These projects are not created by builders, rather, all three are created from one wizard.  Timing is not affected by setting breakpoints, however, it may be timing related because this problem is only reproducible from Eclipse & WTP.  It is not reproducible from an adopter product built on top of Eclipse & WTP.

I will double check to ensure org.eclipse.jdt.core.JavaCore.setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor)
is being properly called.
Comment 14 Kaloyan Raev CLA 2008-09-05 07:54:14 EDT
(In reply to comment #12)
> Created an attachment (id=111584) [details]
> temporary patch
> 
> The above described temporary patch.
> 

I still see the same problem with the current RC1 candidate. 

Jason, have you committed this patch to R3_0_maintenance? I cannot find such change in CVS. Can you check and respin, if necessary, for RC1?
Comment 15 Jason Sholl CLA 2008-09-05 12:28:09 EDT
Requesting review for the temporary patch
Comment 16 Carl Anderson CLA 2008-09-05 13:45:33 EDT
Approved.  (Even tested with EJBAnnotationReaderWithClientTest)
Comment 17 Carl Anderson CLA 2008-09-05 14:25:05 EDT
Committed to R3_0_maintenance for 3.0.2
Comment 18 Kaloyan Raev CLA 2008-09-07 04:43:15 EDT
Verified with the M-3.0.2-20080906061108 build.