This project builds two Java web apps and one shared library:
shared-lib: packaged asshared-lib-1.0.0.jarapp-one: packaged asapp-one.warapp-two: packaged asapp-two.war
By default, both WAR files include shared-lib unchanged. Pass
-PshadowSharedLibrary=true to build relocated application JARs instead.
Gradle Shadow then rewrites the shared package and the servlet bytecode that
references it:
app-one:APP_ONE_com.example.sharedapp-two:APP_TWO_com.example.shared
The source code keeps importing com.example.shared; relocation happens after
compilation.
With local Gradle:
gradle clean copyWars
gradle clean copyWars -PshadowSharedLibrary=trueWithout local Gradle:
docker compose -f docker-compose.build.yml run --rm gradle
docker compose -f docker-compose.build.yml run --rm gradle \
gradle clean copyWars -PshadowSharedLibrary=trueThe deployable WAR files are copied to:
build/deploy/app-one.war
build/deploy/app-two.war
After building with -PshadowSharedLibrary=true:
unzip -p build/deploy/app-one.war \
WEB-INF/lib/app-one-1.0.0-relocated.jar > /tmp/app-one-relocated.jar
unzip -p build/deploy/app-two.war \
WEB-INF/lib/app-two-1.0.0-relocated.jar > /tmp/app-two-relocated.jar
jar tf /tmp/app-one-relocated.jar | grep 'APP_ONE_com/example/shared'
jar tf /tmp/app-two-relocated.jar | grep 'APP_TWO_com/example/shared'
! jar tf /tmp/app-one-relocated.jar | grep '^com/example/shared/'
! jar tf /tmp/app-two-relocated.jar | grep '^com/example/shared/'This is package relocation, not classloader sharing. WebLogic still gives each
WAR its own application classloader, but the debugger now sees different class
names. A WebLogic library-ref removes duplicate files without creating one
class identity across applications; use an EAR or the domain lib directory
when a common parent classloader is required instead.
SERVER_URL=https://dogfood.internal.lightrun.com
COMPANY=
export LIGHTRUN_KEY=
bash -c "$(curl -k -L "$SERVER_URL/public/download/company/$COMPANY/install-agent.sh?platform=linux")"
Oracle WebLogic container images are served from Oracle Container Registry. You may need to sign in at https://container-registry.oracle.com/ and accept the license for the WebLogic image first:
docker login container-registry.oracle.comThen start WebLogic:
docker compose upThe Compose file mounts build/deploy read-only at /u01/oracle/deployments.
scripts/start-weblogic-dev.sh waits until WebLogic creates the domain and then links both WARs into the domain's autodeploy directory.
The Lightrun agent from agent/ is mounted read-only at /u01/oracle/lightrun-agent.
The startup wrapper adds this JVM option before WebLogic starts:
-agentpath:/u01/oracle/lightrun-agent/lightrun_agent.so
Test URLs:
Admin console:
- http://localhost:7001/console
- Username:
weblogic - Password:
Welcome1
You can override the image or credentials:
WEBLOGIC_IMAGE=container-registry.oracle.com/middleware/weblogic:14.1.1.0-dev-11 \
docker compose upAdmin credentials live in properties/domain.properties.
To temporarily run WebLogic without Lightrun:
ENABLE_LIGHTRUN_AGENT=false docker compose up