Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 319955

Summary: gemini.web.tomcat exports javax.xml.* packages as version="1.1.0....
Product: [RT] Gemini.Web Reporter: David Savage <david.savage>
Component: unknownAssignee: Glyn Normington <glyn.normington>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: glyn.normington
Version: unspecified   
Target Milestone: 1.1.0.M03-incubation   
Hardware: All   
OS: All   
Whiteboard:

Description David Savage CLA 2010-07-15 04:13:43 EDT
Build Identifier: 

The problem here is that this causes uses constraint violations when deploying this bundle along side other bundles that import javax.xml.* packages. In felix the framework exports these packages as version=0.0.0.1_006_JavaSE.

I think there are a number of aspects to fixing this however. 

Firstly do the javax.xml packages need to be exported at all? In apache cxf that also uses the javax.xml.* packages their solution is to import the packages with no version, i.e. Import-Package: javax.xml.namespace,org.apache.foo;version=1.0.0. Then rely on the framework to provide these packages vs embedding them in the bundle. This may or may not be appropriate for your usecase.

If they do need to be exported then the javax.xml packages probably shouldn't be inheriting the Tomcat bundle version. But if not then what version should they have? Given this is under discussion by OSGi Alliance not sure what the best answer is.

In my local build I've fixed this problem by rebuilding the tomcat bundle with the following change to org.eclipse.gemini.web.tomcat/template.mf

diff --git a/org.eclipse.gemini.web.tomcat/template.mf b/org.eclipse.gemini.web.tomcat/template.mf
index 6d62570..3109d45 100644
--- a/org.eclipse.gemini.web.tomcat/template.mf
+++ b/org.eclipse.gemini.web.tomcat/template.mf
@@ -28,4 +28,4 @@ Import-Template: org.eclipse.gemini.web.*;version="1.0",
  org.w3c.dom.*;version="0"
 Import-Package: org.apache.catalina.deploy;version="6.0.20.S2-r5956"
 Bundle-Activator: org.eclipse.gemini.web.tomcat.internal.Activator
-Excluded-Exports: *.internal.*
+Excluded-Exports: *.internal.*,javax.*

This seems to work in my testing but I'm not sure if this has unintended consequences outside of the tests I've done (install a simple gwt app as a wab)

Reproducible: Sometimes

Steps to Reproduce:
Happens if gemini bundles are installed along side other bundles that use javax.xml.* packages
Comment 1 Glyn Normington CLA 2010-07-16 06:06:42 EDT
I have excluded the javax.* exports and pushed the change. I am updating the dependency in Virgo web and doing a test build there.
Comment 2 Glyn Normington CLA 2010-07-16 06:06:58 EDT
Oh and thanks for raising this.
Comment 3 Glyn Normington CLA 2010-07-16 06:27:48 EDT
(In reply to comment #1)
> I have excluded the javax.* exports and pushed the change. I am updating the
> dependency in Virgo web and doing a test build there.

Built successfully. I will ripple the change up in due course.
Comment 4 Glyn Normington CLA 2010-07-16 07:31:45 EDT
(In reply to comment #3)
> I will ripple the change up in due course.

Rippled up with no problems. :-)