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

Bug 377433

Summary: [nosql] Constraints from the fragment conflict with the host: Import-Package: javax.naming; version="0.0.0"
Product: z_Archived Reporter: Gunnar Wagenknecht <gunnar>
Component: EclipselinkAssignee: Eric Gwin <eric.gwin>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eric.gwin, tjwatson, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
test target definition
none
test project with target definition and OSGi launch config none

Description Gunnar Wagenknecht CLA 2012-04-23 14:10:38 EDT
Created attachment 214411 [details]
test target definition

PDE Build is "installing" the bundle in order to generate the necessary
build scripts.

The full log can be viewed here:
https://hudson.eclipse.org/hudson/job/gyrex-integration/425/console

I use EclipseLink (incl. NoSQL bundles) from within a PDE target definition.

<location includeAllPlatforms="true" includeMode="slicer"
includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.persistence.sdk.feature.group"
version="2.4.0.v20120411-r11144"/>
<unit id="javax.persistence" version="2.0.4.v201112161009"/>
<unit id="javax.persistence.source" version="2.0.4.v201112161009"/>
<unit id="org.eclipse.persistence.nosql" version="2.4.0.v20120411-r11144"/>
<unit id="org.eclipse.persistence.nosql.source"
version="2.4.0.v20120411-r11144"/>
<repository
location="http://download.eclipse.org/rt/eclipselink/milestone-updates/2.4.0.v20120411-r11144_M17.2/"/>
</location>

I wonder if it's just a false message because both (the nosql bundle as
well as the core bundle) have the package as optional which should be
fine. I can only imagine that it's something specific to the target
platform which may cause the issue.

A simple revert did make the error go away:
http://git.eclipse.org/c/gyrex/gyrex-releng.git/commit/?id=8ff23129162dced554d61c7e030edd5bba6ac365

You can download the whole target platform here:
http://git.eclipse.org/c/gyrex/gyrex-releng.git/plain/org.eclipse.gyrex.releng/targets/gyrex-dev.target?id=37cc35a12057287053969dd0d596eda9b3bdbe90

BTW, I also get the error with the attached (simpler) target definition.
Simply resolve it and set it (in a fresh workspace). Then create a new
Eclipse launch configuration and switch to the "Plug-ins" tab and click
"Validate". The "Contraints conflict.." error also appears there.
Comment 1 Tom Ware CLA 2012-04-23 15:52:49 EDT
Very strange that the march 19 version works... It doesn't appear as though we have changed the imports in either the core or the nosql bundle in that time.
Comment 2 Tom Ware CLA 2012-04-23 15:53:22 EDT
we seem to get javax.naming from the JDK... wonder if that has anything to do with the issue.
Comment 3 Eric Gwin CLA 2012-04-23 16:50:58 EDT
(In reply to comment #0)
> I wonder if it's just a false message because both (the nosql bundle as
> well as the core bundle) have the package as optional which should be
> fine. I can only imagine that it's something specific to the target
> platform which may cause the issue.

I'm wondering something similar. Specifically if this is some p2 resolution issue with optional dependencies. The only imported packages commom between core and nosql are:
 javax.naming;resolution:=optional,
 javax.resource;version="1.5.0";resolution:=optional,
 javax.resource.cci;version="1.5.0";resolution:=optional,

and they are declared identically. I'm wondering if the buildisn't complaining about resource simply because the error condition with naming is hit first.

A question about fragments, if B is a fragment of A; will B inherit the import access of A? If so, we could simply remove the imports above and avoid the issue.
Comment 4 Gunnar Wagenknecht CLA 2012-04-24 04:10:06 EDT
Add Tom, maybe he has some insights. 

I'm wondering if the conflict is because of some usage constraints. To me it seems that the fragment wants to import a different version of the "javax.naming" package which comes from a different bundle (not the JDK?). I also think it's not a p2 issue. The error message also pops up at launch time when validating the bundles with PDE. It's a messages generated by the Equinox OSGi framework.
Comment 5 Thomas Watson CLA 2012-04-24 08:49:07 EDT
(In reply to comment #3)
> A question about fragments, if B is a fragment of A; will B inherit the import
> access of A? If so, we could simply remove the imports above and avoid the
> issue.

Yes, I think you should remove the duplicate imports from the fragment.

Since they are both optional I am wondering if the resolver gets into a state where the host is resolved and it is trying to resolve the fragment.  The hosts optional import of the package did not get resolved when the host was resolved.  Then an attempt is made to resolve the fragment and for some reason the fragments optional import of the package does resolve.  The resolver detects that the fragment is trying to insert a new constraint into an already resolved host.  This is not allowed by the resolver.  In order to allow such a fragment to attach to an already resolved host the host bundle would need to be re-resolved (refreshed).  I am currently trying out Gunners attached target definition.  Unfortunately it seems to take a very long time for the bundles to get downloaded to my target.  Been going for now for as long as it took me to write this message ;-)
Comment 6 Gunnar Wagenknecht CLA 2012-04-24 09:00:38 EDT
Created attachment 214465 [details]
test project with target definition and OSGi launch config

I created a simple launch config. The thing is that javax.naming likely comes from the JDK. Thus I'm wondering why it shouldn't be wired to the host already.... Wait a minute, the  host does define a higher BREE than the fragment. Once I modify the BREE of the fragment then all is fine again. Maybe that is causing the conflict responsible?
Comment 7 Thomas Watson CLA 2012-04-24 09:08:46 EDT
(In reply to comment #6)
> Created attachment 214465 [details]
> test project with target definition and OSGi launch config
> 
> I created a simple launch config. The thing is that javax.naming likely comes
> from the JDK. Thus I'm wondering why it shouldn't be wired to the host
> already.... Wait a minute, the  host does define a higher BREE than the
> fragment. Once I modify the BREE of the fragment then all is fine again. Maybe
> that is causing the conflict responsible?

I was about to write a similar response from my findings.  See bug 377510.  I did not move this bug over to the framework since I still think the fragments should remove duplicate imports which are already defined by the host bundle.  Fragments only need to specify additional constraints not already defined by the host.
Comment 8 Eric Gwin CLA 2012-04-24 09:55:07 EDT
(In reply to comment #7)
> I still think the fragments
> should remove duplicate imports which are already defined by the host bundle. 
> Fragments only need to specify additional constraints not already defined by
> the host.

Ok. I will remove the duplicate entries from the fragment's manifest. FYI: M18 is already awaiting publication, so the change will show up in M19. Otherwise, it should be available in tonight's nightly build: 20120425
Comment 9 Eric Gwin CLA 2012-04-24 11:01:14 EDT
(In reply to comment #5)
> Since they are both optional I am wondering if the resolver gets into a state
> where the host is resolved and it is trying to resolve the fragment.  The hosts
> optional import of the package did not get resolved when the host was resolved.
>  Then an attempt is made to resolve the fragment and for some reason the
> fragments optional import of the package does resolve.  The resolver detects
> that the fragment is trying to insert a new constraint into an already resolved
> host.  This is not allowed by the resolver.  In order to allow such a fragment
> to attach to an already resolved host the host bundle would need to be
> re-resolved (refreshed).  I am currently trying out Gunners attached target
> definition.  Unfortunately it seems to take a very long time for the bundles to
> get downloaded to my target.  Been going for now for as long as it took me to
> write this message ;-)

Upon review of the fix Tom Ware noticed a mismatch in the the Bundle-RequiredExecutionEnvironment settings; org.eclipse.persistence.core had been recently changed to:  JavaSE-1.6
The fragments hadn't been updated yet and remained at: J2SE-1.5

We suspect that is the root cause. I expect I will be updating that as well. Though there is currently discussion regarding that change.

Is there a way to update the Equinox error to report the mismatch rather than give a generic load failure message?
Comment 10 Thomas Watson CLA 2012-04-24 11:06:05 EDT
(In reply to comment #9)

> Is there a way to update the Equinox error to report the mismatch rather than
> give a generic load failure message?

My hope is to provide a fix to bug 377510 so that these false positives are not reported by the resolver.
Comment 11 Eric Gwin CLA 2012-04-24 19:18:41 EDT
(In reply to comment #9)
> 
> ...
> 
> We suspect that is the root cause. I expect I will be updating that as well.
> Though there is currently discussion regarding that change.

The discussion continues. We may be reverting the original change in core. I'm holding off until tomorrow to await a decision.
Comment 12 Eric Gwin CLA 2012-04-26 14:38:32 EDT
Both changes to the manifest merged in rev 377681. removed duplicate import-packages, and set RequiredExecEnv to match core (currently 1.6, though may revert with core to 1.5 in a week or so depending upon results of move to 1.6)

Will be available in tonight's build (v20120427-r?????), and in the M19 milestone (scheduled for May 2 build)
Comment 13 Eric Gwin CLA 2012-04-26 14:40:24 EDT
Moving ro resolved, so can be closed when fixavailable and verified.
Comment 14 Thomas Watson CLA 2012-04-27 09:26:31 EDT
Also, FYI I did fix the original issue in the resolver that was reporting the false positive.  I still think it is good that you removed the duplicate import.
Comment 15 Gunnar Wagenknecht CLA 2012-05-09 08:23:04 EDT
(In reply to comment #12)
> Will be available in tonight's build (v20120427-r?????), and in the M19
> milestone (scheduled for May 2 build)

I still get the error when using the M19 repo. Did it miss the build?
Comment 16 Thomas Watson CLA 2012-05-09 08:29:34 EDT
(In reply to comment #15)
> (In reply to comment #12)
> > Will be available in tonight's build (v20120427-r?????), and in the M19
> > milestone (scheduled for May 2 build)
> 
> I still get the error when using the M19 repo. Did it miss the build?

Are you using the Equinox Juno M7 framework or still on M6?
Comment 17 Gunnar Wagenknecht CLA 2012-05-09 08:56:03 EDT
(In reply to comment #16)
> > I still get the error when using the M19 repo. Did it miss the build?
> 
> Are you using the Equinox Juno M7 framework or still on M6?

Still on an old Equinox. Thus, I think it's the EclipseLink side that still has the conflict.
Comment 18 Eric Gwin CLA 2012-05-09 09:01:35 EDT
(In reply to comment #15)
> (In reply to comment #12)
> > Will be available in tonight's build (v20120427-r?????), and in the M19
> > milestone (scheduled for May 2 build)
> 
> I still get the error when using the M19 repo. Did it miss the build?

Can you try the latest nightly build 20120509-r11315? There has been a lot of churn with the nosql bundle generation. Since the last update we've move it to generating with Tycho, fixed manifest issues with Glassfish, and many more. We also recently discovered that nosql was double building during the nightly process, and unfortunately the old incorrect build was overwriting the newer 'corrected' tycho bundle. We've also had to add back the javax.resource.cci import or Tycho failed to compile. It's possible that all these changes have undone this fix, so I'd like to see if your issue persists with the latest.
Comment 19 Eric Gwin CLA 2012-05-09 10:34:16 EDT
(In reply to comment #17)
> > Are you using the Equinox Juno M7 framework or still on M6?
> 
> Still on an old Equinox. Thus, I think it's the EclipseLink side that still has
> the conflict.

Still the newer equinox may help. 

On our side, I've exploded M19 and have confirmed the bundle published was generated using the old bnd pathway and doesn't have the fixes. Unfortunately last night's build is unsuitable as a milestone for unrelated reasons. If I can confirm last night's build is good for you, I may be able to turn around a new milestone.
Comment 20 Gunnar Wagenknecht CLA 2012-05-09 13:44:06 EDT
I can confirm that the latest nightly does not expose the issue.
Comment 21 Eric Gwin CLA 2012-05-09 16:31:42 EDT
(In reply to comment #20)
> I can confirm that the latest nightly does not expose the issue.

ok. we fixed our other issue and rebuilt. Promoted M19.1 based upon build 2.4.0.v20120509-r1132, however didn't want to risk Juno M7. Let me know if this doesn't solve your issue.
Comment 22 Eclipse Webmaster CLA 2022-06-09 10:03:38 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink