Skip to content

Devc port resolution fixes - #544

Merged
sajeerzeji merged 13 commits into
OpenLiberty:1.xfrom
sajeerzeji:fix/GH541-devc_port_resolution
Sep 23, 2026
Merged

sajeerzeji merged 13 commits into
OpenLiberty:1.xfrom
sajeerzeji:fix/GH541-devc_port_resolution

Conversation

@sajeerzeji

Copy link
Copy Markdown
Contributor

Fixes #541
When running liberty:devc, the container port flags were always hardcoded to the Liberty defaults (9080/9443) regardless of what ports were actually configured in server.xml, causing "Unable to retrieve locally mapped port" errors for projects using non-default ports.
It now resolves the HTTP and HTTPS ports before building the container command by reading the httpEndpoint element from the server configuration and resolving any variable references through ServerConfigDocument, which will follow the full Liberty variable precedence chain including bootstrap.properties, server.env, and configDropins/overrides. The resolved ports are also used for the container volume mounts so that Liberty starts on the same port that was published to the host.

@sajeerzeji
sajeerzeji changed the base branch from main to 1.x September 9, 2026 11:43
Comment thread src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java Outdated
Comment thread src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java Outdated
Comment thread src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java Outdated
@sajeerzeji

sajeerzeji commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Adding recording of the manual test in a test project

Screen.Recording.2026-09-14.at.5.12.48.PM.mov

Proof that the tests passed in ci.maven
image

Proof that the tests passed in ci.gradle
image

@sajeerzeji

sajeerzeji commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Screen recordding of manual test using custom configuration file

Screen.Recording.2026-09-16.at.3.01.28.PM.mov

Comment thread src/main/java/io/openliberty/tools/common/plugins/config/XmlDocument.java Outdated
Comment thread src/main/java/io/openliberty/tools/common/plugins/config/XmlDocument.java Outdated
Comment thread src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java
Comment thread src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java Outdated
Comment thread src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java Outdated
Comment thread src/main/java/io/openliberty/tools/common/CommonLoggerI.java

@cherylking cherylking left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much better.

Comment thread src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java Outdated
Comment thread src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java Outdated
Comment thread src/main/java/io/openliberty/tools/common/plugins/util/DevUtil.java Outdated
@sajeerzeji
sajeerzeji merged commit 4576992 into OpenLiberty:1.x Sep 23, 2026
10 checks passed
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.

libertyDevc / devc reports "Unable to retrieve locally mapped port" when Liberty HTTP port is set to a non-default value

3 participants