Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351083 - cannot install by reference WTP project to a osgi based web container.
Summary: cannot install by reference WTP project to a osgi based web container.
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7.1   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 352297 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-04 08:54 EDT by Dimitar Giormov CLA
Modified: 2011-07-18 09:55 EDT (History)
5 users (show)

See Also:


Attachments
added check if the framework is in development mode. (1.37 KB, patch)
2011-07-04 08:57 EDT, Dimitar Giormov CLA
no flags Details | Diff
possible patch (untested) (2.88 KB, patch)
2011-07-05 11:04 EDT, Thomas Watson CLA
no flags Details | Diff
patch + test (6.23 KB, patch)
2011-07-06 16:36 EDT, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitar Giormov CLA 2011-07-04 08:54:43 EDT
Hi,

In version 3.7 of org.eclipse.osgi bundle was submitted a patch  (Bug 320546) that broke installing by reference of WTP web project to osgi based web container such as Gemini Web

The scenario is described in details here:
http://wiki.eclipse.org/Gemini/Web
(create web project with OSGi facet installed)

The reason is that the patch will not allow for classes outside of the bundle root to be loaded. The structure of WTP web project is the following:

  /Project Root
      /build/classes (class output folder)
      /WebContent/ (Bundle root)

so the class files are not in the bundle root and if the project is installed by reference the classes cannot be loaded.

Best regards,
Dimitar
Comment 1 Dimitar Giormov CLA 2011-07-04 08:57:15 EDT
Created attachment 199046 [details]
added check if the framework is in development mode.
Comment 2 Dimitar Giormov CLA 2011-07-04 08:58:26 EDT
Just to add the entry in the dev.properties file for the project looks like this:

web_project_name=../build/classes
Comment 3 Thomas Watson CLA 2011-07-05 10:46:12 EDT
I would prefer to limit this fix to DevClassLoadingHook instead of introducing a wide security whole when in dev mode.  My thought is org.eclipse.osgi.internal.baseadaptor.DevClassLoadingHook.addClassPathEntry method can be changed to find external, relative class path entries.
Comment 4 Thomas Watson CLA 2011-07-05 11:02:45 EDT
Curtis (and others), is there some way the WTP project is telling PDE that the bundle root is something other than the project root folder?
Comment 5 Thomas Watson CLA 2011-07-05 11:04:32 EDT
Created attachment 199135 [details]
possible patch (untested)

Here is a patch with what I am thinking.  I still need to test the fix.
Comment 6 Andrew Niefer CLA 2011-07-05 11:21:38 EDT
(In reply to comment #4)
> Curtis (and others), is there some way the WTP project is telling PDE that the
> bundle root is something other than the project root folder?

PDE does support a "flexible root" where the manifest is somewhere other than the project root/META-INF.  I found Bug 297895 and Bug 309572.
Comment 7 Thomas Watson CLA 2011-07-05 17:05:09 EDT
(In reply to comment #0)

> The scenario is described in details here:
> http://wiki.eclipse.org/Gemini/Web
> (create web project with OSGi facet installed)

For others, the "OSGi Bundle Facet" can be installed from the Indigo main repository into the EPP Eclipse Java EE IDE for Web Developers.  I am sorry to admit it took me quite a long time to figure out that this is what you were referring to ;-)

With this installed I can reproduce the issue and confirm that the patch seems to fix the issue.
Comment 8 Dimitar Giormov CLA 2011-07-06 07:11:49 EDT
thanks Thomas,

You can mark my patch obsolete. That was the simplest way to workaround the situation. I have also tested your fix and it works for us.
Comment 9 Thomas Watson CLA 2011-07-06 16:36:56 EDT
Created attachment 199210 [details]
patch + test

Here is the same patch + a test.
Comment 10 Thomas Watson CLA 2011-07-08 17:27:37 EDT
I released the patch to master:

http://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?id=9cff86cd95fd7d47383fea06157a0a2663b0c386

Leaving open to release to 3.7.1.
Comment 12 Thomas Watson CLA 2011-07-18 09:55:32 EDT
*** Bug 352297 has been marked as a duplicate of this bug. ***