Skip to content

Launch Configuration doesn't respect bundle version in feature.xml #2367

Description

@ptziegler

For context, our workspace contains two products. One product is using Jersey 2.x, the other 3.x. With the 2026-06, this has changed to 2.x and 4.x. But since then, we are no longer able to start the 2.x-based product, as it now pulls in the 4.x artifacts.

Target Platform
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="target-platform">
	<locations>
		<location path="${eclipse_home}" type="Profile"/>
		<location includeDependencyDepth="infinite" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
			<dependencies>
				<dependency>
					<groupId>jakarta.xml.bind</groupId>
					<artifactId>jakarta.xml.bind-api</artifactId>
					<version>2.3.3</version>
					<type>jar</type>
				</dependency>
				<dependency>
					<groupId>org.glassfish.jersey.core</groupId>
					<artifactId>jersey-server</artifactId>
					<version>2.48</version>
					<type>jar</type>
				</dependency>
				<dependency>
					<groupId>org.glassfish.jersey.core</groupId>
					<artifactId>jersey-server</artifactId>
					<version>3.1.11</version>
					<type>jar</type>
				</dependency>
			</dependencies>
		</location>
	</locations>
</target>
Feature
<?xml version="1.0" encoding="UTF-8"?>
<feature
      id="Jersey"
      label="Dependencies"
      version="1.0.0.qualifier">

   <description url="http://www.example.com/description">
      [Enter Feature Description here.]
   </description>

   <copyright url="http://www.example.com/copyright">
      [Enter Copyright Description here.]
   </copyright>

   <license url="http://www.example.com/license">
      [Enter License Description here.]
   </license>

   <plugin
         id="org.glassfish.jersey.core.jersey-client"
         version="2.48.0"/>

   <plugin
         id="org.glassfish.jersey.core.jersey-common"
         version="2.48.0"/>

   <plugin
         id="org.glassfish.jersey.core.jersey-server"
         version="2.48.0"/>

   <plugin
         id="jakarta.annotation-api"
         version="1.3.5"/>

   <plugin
         id="jakarta.inject.jakarta.inject-api"
         version="1.0.5"/>

   <plugin
         id="jakarta.ws.rs-api"
         version="2.1.6"/>

   <plugin
         id="jakarta.activation-api"
         version="1.2.2"/>

   <plugin
         id="org.glassfish.hk2.osgi-resource-locator"
         version="1.0.3"/>

   <plugin
         id="jakarta.xml.bind-api"
         version="2.3.3"/>

   <plugin
         id="org.eclipse.equinox.console"
         version="0.0.0"/>

   <plugin
         id="org.apache.felix.gogo.command"
         version="0.0.0"/>

   <plugin
         id="org.apache.felix.gogo.runtime"
         version="0.0.0"/>

   <plugin
         id="org.apache.felix.gogo.shell"
         version="0.0.0"/>

</feature>
Launch Configuration
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
    <setAttribute key="additional_plugins"/>
    <booleanAttribute key="append.args" value="true"/>
    <booleanAttribute key="automaticAdd" value="false"/>
    <booleanAttribute key="automaticIncludeRequirements" value="false"/>
    <booleanAttribute key="automaticValidate" value="true"/>
    <stringAttribute key="bootstrap" value=""/>
    <stringAttribute key="checked" value="[NONE]"/>
    <booleanAttribute key="clearConfig" value="true"/>
    <stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/Jersey"/>
    <booleanAttribute key="default" value="false"/>
    <booleanAttribute key="default_auto_start" value="true"/>
    <intAttribute key="default_start_level" value="4"/>
    <setAttribute key="deselected_workspace_bundles"/>
    <stringAttribute key="featureDefaultLocation" value="workspace"/>
    <stringAttribute key="featurePluginResolution" value="workspace"/>
    <booleanAttribute key="includeOptional" value="true"/>
    <booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
    <booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
    <booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
    <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
    <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
    <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -console"/>
    <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
    <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true"/>
    <stringAttribute key="pde.version" value="3.3"/>
    <setAttribute key="selected_features">
        <setEntry value="Jersey:default"/>
    </setAttribute>
    <setAttribute key="selected_target_bundles"/>
    <setAttribute key="selected_workspace_bundles"/>
    <booleanAttribute key="show_selected_only" value="false"/>
    <booleanAttribute key="tracing" value="false"/>
    <booleanAttribute key="useCustomFeatures" value="true"/>
    <booleanAttribute key="useDefaultConfigArea" value="true"/>
</launchConfiguration>

Here the zipped workspace:

ws-jersey.zip

This is the validation error I get when launching the application:

Image

... and then the start fails with:

org.osgi.framework.BundleException: Could not resolve module: org.glassfish.jersey.core.jersey-server [10]
  Unresolved requirement: Import-Package: org.glassfish.jersey; version="[2.48.0,3.0.0)"

	at org.eclipse.osgi.container.Module.start(Module.java:495)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:2110)
	at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:146)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:2101)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:2043)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:2003)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1915)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:341)

Even though jersey-common is set to 2.48.0 in the feature.xml, the newer 4.0.2 is chosen. This doesn't happen when I have Jersey 2.48 and 3.1.11 in the classpath.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions