Skip to content

Fix: Skip already-installed user features in installServerFeatures when custom Maven mirror is configured#34843

Open
riyaaroraa wants to merge 4 commits into
OpenLiberty:integrationfrom
riyaaroraa:fix/install-server-features-user-feature-resolution
Open

Fix: Skip already-installed user features in installServerFeatures when custom Maven mirror is configured#34843
riyaaroraa wants to merge 4 commits into
OpenLiberty:integrationfrom
riyaaroraa:fix/install-server-features-user-feature-resolution

Conversation

@riyaaroraa
Copy link
Copy Markdown
Contributor

@riyaaroraa riyaaroraa commented May 7, 2026

Problem

When featureUtility installServerFeatures is called with a custom Maven mirror
configured (e.g. an Artifactory proxy), it fails with:

CWWKF1402E: The following features were not obtained: ibmProcessServer

The root cause is that the resolver passes ALL features from server.xml to the
repository — including user features like ibmProcessServer that are already
installed in the Liberty usr directory and don't exist in Maven at all.

With Maven Central (no mirror), the resolver gets a clean 404 for the user
feature and since it's already present in installedFeatures, it handles it
gracefully. But with a custom mirror, the mirror returns a 429 (rate limit) or
connection error instead of a clean 404 — by the time it falls back to Maven
Central, the resolver has already marked the feature resolution as failed.

This was causing Docker builds to fail across multiple teams when they set up
Artifactory mirrors to work around Maven Central rate limiting. Ennio's team
confirmed the workaround was removing installServerFeatures and installing
features manually — this fix automates that by filtering user features before
they reach the resolver.

Fix

  • Extracted filterOutInstalledUserFeatures() as a package-private method
    that detects user features using getBundleRepositoryType() returning "usr"
  • When installServerFeatures is called, already-installed user features are
    filtered out before being passed to the resolver
  • Handles all feature name formats: usr:featureName,
    featureName:featureName, and plain featureName
  • The ALREADY_EXISTS check for installFeature is preserved using the
    original feature list size

Testing

Added 6 unit tests to InstallKernelMapTest covering:

  • User feature filtered from installServerFeatures list
  • Core Liberty features not filtered
  • All three name format variants (usr:, name:name, plain name)
  • Empty installed features list
  • Case-insensitive matching
  • Exact ibmProcessServer scenario from the reported bug

Reviewe

Note for reviewer: This fix removes already-installed user features from the
resolver input entirely. Please confirm this is safe — specifically that
skipping them won't cause auto-features or internal feature dependencies
to be missed.

When installServerFeatures is called with a custom Maven mirror configured,
it was attempting to resolve user features that were already installed in
the Liberty usr directory. This caused CWWKF1402E errors when the resolver
couldn't find these user features in the Maven repository.

The fix:
- Extracted filtering logic into filterOutInstalledUserFeatures() helper method
- Detects user features using getBundleRepositoryType() which returns 'usr'
- Filters out already-installed user features before passing to the resolver
- Only applies when isInstallServerFeature is true
- Handles various feature name formats (usr:name, name:name, name)
- Preserves original feature count for 'all already installed' check

Added comprehensive unit tests:
- testInstalledUserFeatureFilteredFromInstallServerFeatures: Verifies user features are filtered
- testNonUserFeatureNotFiltered: Ensures core Liberty features are not filtered
- testUserFeatureNameFormatVariations: Tests usr:name, name:name, and name formats
- testNoUserFeaturesInstalled: Verifies behavior when no user features present
- testCaseInsensitiveFeatureMatching: Tests case-insensitive feature name matching
- testIbmProcessServerScenario: Reproduces the exact reported bug scenario

This resolves the issue where Docker builds with Artifactory mirrors would
fail when trying to install features on images with pre-installed user
features like ibmProcessServer.

Related to GitHub issue OpenLiberty#30585
@riyaaroraa riyaaroraa self-assigned this May 7, 2026
…edUserFeatures

- Now catches both default 'usr' extension and custom extensions like 'ibmProcessServer'
- Updated comments to reflect 'product extension features' terminology
- Added test for custom product extension (ibmProcessServer:ibmProcessServer)
- Fixed comment format from 'featureName:featureName' to 'extensionName:featureName'

Addresses Sarah's code review feedback on PR OpenLiberty#34843
- Changed getBundleRepositoryType() mock from 'usr' to 'ibmProcessServer'
- Added clarifying comment that ibmProcessServer is a custom product extension
- This accurately reflects the real scenario from the bug report
- Changed comment from 'user feature' to 'product extension feature'
- Ensures consistent terminology throughout the test file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant