The repository provides aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/WASdev/sample.daytrader7/llms.txt
Use this file to discover all available pages before exploring further.
Containerfile_db2 that packages DayTrader 7 on top of the official IBM WebSphere Liberty kernel image (icr.io/appcafe/websphere-liberty:kernel-java17-openj9-ubi), using Java 17 with the Eclipse OpenJ9 JVM on Red Hat Universal Base Image (UBI). The container is configured for a DB2 backend via server_db2_container.xml, which resolves all database connection details from environment variables passed at docker run time.
The repository also contains a plain
Dockerfile (based on open-liberty:full) that packages DayTrader 7 with the Derby-embedded database and server.xml. It is suitable for quick local container runs without an external database, but is not intended for load testing or production use. Build it with docker build -t sample-daytrader7 . from the repository root.Prerequisites
Docker or Podman
Any OCI-compatible container runtime. Commands below use
docker; substitute podman if preferred.DB2 Instance
A DB2 server reachable from the container, with a
TRADEDB database created and a user account ready.DB2 JDBC Jars
db2jcc4.jar and db2jcc_license_cu.jar must be present in a local db2jars/ directory at build time.Containerfile
The fullContainerfile_db2 is reproduced below. The configure.sh script at the end is provided by the WebSphere Liberty base image and applies any requested XML feature snippets, grows the image to a fit-for-purpose size, and applies available interim fixes:
What gets copied into the image
| Source path | Container destination | Purpose |
|---|---|---|
daytrader-ee7/target/daytrader-ee7.ear | /config/apps/ | The compiled DayTrader 7 application archive |
daytrader-ee7/src/main/liberty/config/server_db2_container.xml | /config/server.xml | Liberty server config with DB2 data source and mpHealth / transportSecurity features |
jvm.container.options | /config/ | Container-optimized JVM flags (verbose GC, heap dump, aggressive opts) |
db2jars/ | /opt/ibm/wlp/usr/shared/resources/db2jars/ | DB2 JDBC Type 4 driver jars |
jvm.container.options
Thejvm.container.options file is automatically picked up by Liberty inside the container and enables verbose GC logging, heap dumps, and OpenJ9 aggressive optimizations:
Build the image
Build the Maven artifact
The Containerfile expects the compiled EAR at
daytrader-ee7/target/daytrader-ee7.ear. Run the full Maven build from the repository root first:Stage the DB2 JDBC jars
Create a
db2jars/ directory at the repository root and copy in both driver files from your DB2 installation:The
COPY --chown=1001:0 db2jars /opt/ibm/wlp/usr/shared/resources/db2jars instruction in the Containerfile expects this directory to exist at build time relative to the build context (the repository root). Liberty’s server_db2_container.xml references the jars from ${shared.resource.dir}/db2jars.Run the container
Pass all five required environment variables to connect to your DB2 instance. The application exposes HTTPS on port 9443:| Environment variable | Description |
|---|---|
dbUser | DB2 user that Liberty uses to authenticate (e.g. db2inst1) |
dbPass | Password for dbUser |
tradeDbHost | Hostname or IP address of the DB2 server, reachable from inside the container |
tradeDbPort | DB2 listener port — default is 50000 |
tradeDbName | Name of the DB2 database — default is TRADEDB |
Initialize the database
Once the container is running, open the DayTrader configuration page and create the schema and seed data:After first-time database population, restart the container so Liberty reinitializes its connection pool and JMS resources cleanly against the populated schema:
Server configuration (container)
Theserver_db2_container.xml used inside the image extends the standard DB2 configuration with two additional Liberty features needed in a containerized environment — mpHealth-1.0 (used by Kubernetes liveness/readiness probes) and transportSecurity-1.0 (TLS support for the HTTPS endpoint):