Skip to content

--server.port=9000 is not respected on Windows (both cmd as Powershell) #1173

Closed
@MartenBE

Description

When starting WebGoat with the --server.port=9000 on Windows, WebGoat ignores the parameter and uses port 8080. This occurs on both the regular CMD as PowerShell.

C:\Users\martijn\Downloads>java -jar webgoat-server-8.2.2.jar --server.port=9000
19:11:50.655 [main] INFO org.owasp.webgoat.StartWebGoat - Starting WebGoat with args: --server.port=9000
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.4.3)
2021-11-24 19:11:52.166  INFO 14432 --- [           main] org.owasp.webgoat.StartWebGoat           : Starting StartWebGoat v8.2.2 using Java 17.0.1 on BIESTE with PID 14432 (C:\Users\martijn\Downloads\webgoat-server-8.2.2.jar started by martijn in C:\Users\martijn\Downloads)
2021-11-24 19:11:52.167 DEBUG 14432 --- [           main] org.owasp.webgoat.StartWebGoat           : Running with Spring Boot v2.4.3, Spring v5.3.4
2021-11-24 19:11:52.168  INFO 14432 --- [           main] org.owasp.webgoat.StartWebGoat           : No active profile set, falling back to default profiles: default
2021-11-24 19:11:55.769  INFO 14432 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-11-24 19:11:56.061  INFO 14432 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 277 ms. Found 2 JPA repository interfaces.
2021-11-24 19:11:57.185  WARN 14432 --- [           main] io.undertow.websockets.jsr               : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2021-11-24 19:11:57.213  INFO 14432 --- [           main] io.undertow.servlet                      : Initializing Spring embedded WebApplicationContext
2021-11-24 19:11:57.214  INFO 14432 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 4909 ms
2021-11-24 19:11:57.485  INFO 14432 --- [           main] org.owasp.webgoat.HSQLDBDatabaseConfig   : Starting internal database on port 9001 ...
[Server@7692cd34]: [Thread[main,5,main]]: checkRunning(false) entered
[Server@7692cd34]: [Thread[main,5,main]]: checkRunning(false) exited
[Server@7692cd34]: [Thread[main,5,main]]: setDatabaseName(0,webgoat)
[Server@7692cd34]: [Thread[main,5,main]]: checkRunning(false) entered
[Server@7692cd34]: [Thread[main,5,main]]: checkRunning(false) exited
[Server@7692cd34]: [Thread[main,5,main]]: setDatabasePath(0,C:\Users\martijn/.webgoat-8.2.2//data/webgoat)
[Server@7692cd34]: [Thread[main,5,main]]: checkRunning(false) entered
[Server@7692cd34]: [Thread[main,5,main]]: checkRunning(false) exited
[Server@7692cd34]: [Thread[main,5,main]]: setDaemon(true)
[Server@7692cd34]: [Thread[main,5,main]]: checkRunning(false) entered
[Server@7692cd34]: [Thread[main,5,main]]: checkRunning(false) exited
[Server@7692cd34]: [Thread[main,5,main]]: setAddress(127.0.0.1)
[Server@7692cd34]: [Thread[main,5,main]]: setTrace(false)
[Server@7692cd34]: Initiating startup sequence...
[Server@7692cd34]: Server socket opened successfully in 0 ms.
2021-11-24 19:11:57.812  INFO 14432 --- [erver @7692cd34] hsqldb.db.HSQLDB7D511ECE75.ENGINE        : checkpointClose start
2021-11-24 19:11:57.813  INFO 14432 --- [erver @7692cd34] hsqldb.db.HSQLDB7D511ECE75.ENGINE        : checkpointClose synched
2021-11-24 19:11:57.842  INFO 14432 --- [erver @7692cd34] hsqldb.db.HSQLDB7D511ECE75.ENGINE        : checkpointClose script done
2021-11-24 19:11:57.899  INFO 14432 --- [erver @7692cd34] hsqldb.db.HSQLDB7D511ECE75.ENGINE        : checkpointClose end
[Server@7692cd34]: Database [index=0, id=0, db=file:C:\Users\martijn/.webgoat-8.2.2//data/webgoat, alias=webgoat] opened successfully in 370 ms.
[Server@7692cd34]: Startup sequence completed in 372 ms.
[Server@7692cd34]: 2021-11-24 18:11:57.903 HSQLDB server 2.5.1 is online on port 9001
[Server@7692cd34]: To close normally, connect and execute SHUTDOWN SQL
[Server@7692cd34]: From command line, use [Ctrl]+[C] to abort abruptly
2021-11-24 19:11:58.113  INFO 14432 --- [           main] o.f.c.internal.license.VersionPrinter    : Flyway Community Edition 7.1.1 by Redgate
2021-11-24 19:11:58.353  INFO 14432 --- [           main] o.f.c.i.database.base.DatabaseType       : Database: jdbc:hsqldb:hsql://127.0.0.1:9001/webgoat (HSQL Database Engine 2.5)
2021-11-24 19:11:58.414  INFO 14432 --- [           main] o.f.core.internal.command.DbValidate     : Successfully validated 3 migrations (execution time 00:00.032s)
2021-11-24 19:11:58.426  INFO 14432 --- [           main] o.f.core.internal.command.DbMigrate      : Current version of schema "container": 2
2021-11-24 19:11:58.428  INFO 14432 --- [           main] o.f.core.internal.command.DbMigrate      : Schema "container" is up to date. No migration necessary.
2021-11-24 19:11:58.782  INFO 14432 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-11-24 19:11:59.005  INFO 14432 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.28.Final
2021-11-24 19:11:59.256  INFO 14432 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-11-24 19:11:59.596  INFO 14432 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
2021-11-24 19:12:00.580  INFO 14432 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-11-24 19:12:00.597  INFO 14432 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-11-24 19:12:01.924  WARN 14432 --- [           main] o.o.webgoat.lessons.CourseConfiguration  : Lesson: webgoat.title has no endpoints, is this intentionally?
2021-11-24 19:12:02.121  WARN 14432 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2021-11-24 19:12:02.462  INFO 14432 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@4d0e54e0, org.springframework.security.web.context.SecurityContextPersistenceFilter@939ff41, org.springframework.security.web.header.HeaderWriterFilter@3d0cac1f, org.springframework.security.web.authentication.logout.LogoutFilter@772caabe, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@72b43104, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@48a663e9, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@56476c16, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@32f96bba, org.springframework.security.web.session.SessionManagementFilter@d257579, org.springframework.security.web.access.ExceptionTranslationFilter@5c7dfc05, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@b3e86d5]
2021-11-24T19:12:04.146+01:00 [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.
2021-11-24 19:12:06.648  INFO 14432 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-11-24 19:12:07.130  INFO 14432 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2021-11-24 19:12:07.172  INFO 14432 --- [           main] io.undertow                              : starting server: Undertow - 2.2.4.Final
2021-11-24 19:12:07.189  INFO 14432 --- [           main] org.xnio                                 : XNIO version 3.8.0.Final
2021-11-24 19:12:07.203  INFO 14432 --- [           main] org.xnio.nio                             : XNIO NIO Implementation Version 3.8.0.Final
2021-11-24 19:12:07.317  INFO 14432 --- [           main] org.jboss.threads                        : JBoss Threads version 3.1.0.Final
2021-11-24 19:12:07.367  INFO 14432 --- [           main] o.s.b.w.e.undertow.UndertowWebServer     : Undertow started on port(s) 8080 (http) with context path '/WebGoat'
2021-11-24 19:12:07.385  INFO 14432 --- [           main] org.owasp.webgoat.StartWebGoat           : Started StartWebGoat in 16.308 seconds (JVM running for 17.433)

You can see the parameter is detected:

19:11:50.655 [main] INFO org.owasp.webgoat.StartWebGoat - Starting WebGoat with args: --server.port=9000

But port 8080 is still used instead of 9000:

2021-11-24 19:12:07.367  INFO 14432 --- [           main] o.s.b.w.e.undertow.UndertowWebServer     : Undertow started on port(s) 8080 (http) with context path '/WebGoat'

I've noticed this in class with multiple students using Windows, unfortunately I cannot link it to a certain cause.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions