Weblogic 12.2.1.4
https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server
/12.2.1.4/index.html
/12.2.1.4/index.html
General HOWTO
Create Weblogic Docker image
See blogpost https://danielveselka.blogspot.com/2017/10/build-weblogic-docker-image.htmlCreate Weblogic generic Docker domain
See sample from Oracle
https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain
Weblogic installers
https://www.oracle.com/middleware/technologies/weblogic-server-installers-downloads.html
12.2.1.4 now also has SLIM image - interesting for Kubernetes deployment
The WebLogic
slim
image is supported for development
and production
deployment of WebLogic configurations using Docker. In order to reduce image size, it contains a subset of the binaries included in the WebLogic generic image. The WebLogic console, WebLogic examples, WebLogic clients, Maven plug-ins and Java DB have been removed - all binaries that remain included are the same as those in the WebLogic generic image. The WebLogic slim image is primarily intended for WebLogic domains managed with the WebLogic Kubernetes Operator, when WLS console-based monitoring and configuration is not required, and a smaller image size than the generic image is preferred. If there are requirements to monitor the WebLogic configuration, they should be addressed using Prometheus and Grafana or other alternatives. All servers within a domain managed with the Operator will use the same WebLogic image. Support is also provided for environments where Kubernetes and/or the WebLogic Kubernetes Operator is not being used.Get the sample code
Clone the modified code from https://github.com/dveselka/weblogic
https://github.com/dveselka/weblogic/tree/master/docker-domain
Install generic Weblogic - required for Oracle Maven repo configuration
[dave@localhost Downloads]$ java -jar fmw_12.2.1.4.0_wls.jar
Configure Oracle Maven repository
https://blogs.oracle.com/weblogicserver/docker,-java-ee-7,-and-maven-with-weblogic-1213-v2
https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/wlprg/maven.html#GUID-C6FC7582-2D1C-4EA5-B000-71AE9A2F2B05
cd ./oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.2.1
[dave@localhost 12.2.1]$ mvn install:install-file -DpomFile=oracle-maven-sync-12.2.1.pom -Dfile=oracle-maven-sync-12.2.1.jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /app/weblogic/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.2.1/oracle-maven-sync-12.2.1.jar to /home/dave/.m2/repository/com/oracle/maven/oracle-maven-sync/12.2.1-4-0/oracle-maven-sync-12.2.1-4-0.jar
[INFO] Installing /app/weblogic/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.2.1/oracle-maven-sync-12.2.1.pom to /home/dave/.m2/repository/com/oracle/maven/oracle-maven-sync/12.2.1-4-0/oracle-maven-sync-12.2.1-4-0.pom
mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=/app/weblogic
[INFO] SUMMARY
[INFO] ------------------------------------------------------------------------
[INFO] PUSH SUMMARY - ARTIFACTS PROCESSED SUCCESSFULLY
[INFO] ------------------------------------------------------------------------
[INFO] Number of artifacts pushed: 1267
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] PUSH SUMMARY - ERRORS ENCOUNTERED
[INFO] ------------------------------------------------------------------------
[INFO] No issues encountered.
[INFO]
[INFO] IMPORTANT NOTE
[INFO] This operation may have added/updated archetypes in your repository.
[INFO] To update your archetype catalog, you should run:
[INFO] 'mvn archetype:crawl -Dcatalog=$HOME/.m2/archetype-catalog.xml'
[dave@localhost 12.2.1]$ find /home/dave/.m2/repository/com/oracle -name weblogic-maven-plugin
/home/dave/.m2/repository/com/oracle/weblogic/weblogic-maven-plugin
[dave@localhost 12.2.1]$ ls -l /home/dave/.m2/repository/com/oracle/weblogic/weblogic-maven-plugin
total 16
drwxrwxr-x. 2 dave dave 4096 Oct 27 12:40 12.2.1-0-0
drwxrwxr-x. 2 dave dave 4096 Oct 27 12:01 12.2.1-2-0
drwxrwxr-x. 2 dave dave 4096 Oct 27 12:38 12.2.1-4-0
Validate the installed Weblogic Maven plugin
mvn help:describe -DgroupId=com.oracle.weblogic -DartifactId=weblogic-maven-plugin -Dversion=12.2.1-4-0
Name: weblogic-maven-plugin
Description: The Oracle WebLogic Server 12.2.1 Maven plugin
Group Id: com.oracle.weblogic
Artifact Id: weblogic-maven-plugin
Version: 12.2.1-4-0
Goal Prefix: weblogic
This plugin has 23 goals:
weblogic:appc
Description: This goal is a wrapper for the weblogic.appc compiler.
weblogic:create-domain
Description: Create a domain for WebLogic Server using the default domain
template. For more complex domain creation use the WLST goal. Note:
Starting in WLS 12.2.1, there is a single unified version of WLST that
automatically includes the WLST environment from all products in the
ORACLE_HOME.
weblogic:deploy
Description: Deploys an application to WebLogic Server (supports all
formats WAR, JAR, RAR, EAR, etc.)
weblogic:distribute-app
Description: Prepares deployment files for deployment by copying deployment
files to target servers and validating them.
weblogic:install
Description: Installs WebLogic Server
weblogic:list-apps
Description: Lists the deployment names for applications and stand-alone
modules deployed distributed, or installed to the domain
weblogic:purge-tasks
Description: Flushes out retired deployment tasks
weblogic:redeploy
Description: Redeploys a running application or part of a running
application
weblogic:remove-domain
Description: This class provides basic capabilities to remove a domain
directory.
weblogic:start-app
Description: Starts an application
weblogic:start-server
Description: Starts WebLogic Server.
weblogic:stop-app
Description: Stops an application
weblogic:stop-server
Description: This goals run a stop script to stop WebLogic Server.
weblogic:undeploy
Description: Stops the deployment unit and removes staged files from target
servers
weblogic:uninstall
Description: Uninstalls WebLogic Server
weblogic:update-app
Description: Updates an application's deployment plan by redistributing the
plan files and reconfiguring the application based on the new plan
contents.
weblogic:wlst
Description: This goal is a wrapper for the WLST scripting tool.
Note: Starting in WLS 12.2.1, there is a single unified version of WLST
that automatically includes the WLST environment from all products in the
ORACLE_HOME.
weblogic:wlst-client
Description: WLST wrapper for Maven that does not require a server install
for WLST online commands.
weblogic:ws-clientgen
Description: A Maven goal to generate client web service artifacts from a
WSDL Note the differences between clientgen Ant task and Maven goal:
clientgen goal only generates JAXWS web service artifacts, while Ant task
has JAXRPC as the default. At the moment there is no way to direct
clientgen goal to also compile and package generated artifacts.
Deprecated. No reason given
weblogic:ws-jwsc
Description: This goal builds a JAX-WS web service, generates source code,
data binding artifacts, deployment descriptors, and so on into an output
directory.
Deprecated. No reason given
weblogic:ws-wsdlc
Description: This goal generates, from an existing WSDL file, a set of
artifacts that together provide a partial Java implementation of the Web
Service described by the WSDL file.
Deprecated. No reason given
weblogic:wsgen
Description: Reads a JAX-WS service endpoint implementation class and
generates all of the portable artifacts for a JAX-WS web service.
weblogic:wsimport
Description: Parses wsdl and binding files and generates Java code needed
to access it.
For more information, run 'mvn help:describe [...] -Ddetail'
Configure the properties for the Docker Weblogic domain
Set the weblogic Admin user/password in
./docker-domain/OracleWebLogic/samples/12214-domain-generic/properties/domain_security.properties
Create the domain using ./docker-domain/OracleWebLogic/samples/12214-domain-generic/build.sh
docker build -f Dockerfile -t 12214-weblogic-domain-generic .
This creates Docker image
[dave@localhost weblogic]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
12214-weblogic-domain-generic latest 0c7c40704362 43 minutes ago 1.26GB
Change the domain Docker image name in run_admin_server.sh script
./docker-domain/OracleWebLogic/samples/12214-domain-generic/run_admin_server.sh
[dave@localhost weblogic]$ grep 12214-weblogic-domain-generic ./docker-domain/OracleWebLogic/samples/12214-domain-generic/run_admin_server.sh
echo "docker run -d -p 9001:7001 -p 9002:9002 --name ${adminhost} --hostname ${adminhost} -v ${scriptDir}/properties:/u01/oracle/properties -v ${domainhostvol}:/u01/oracle/user_projects/domains ${ENV_ARG} 12214-weblogic-domain-generic"
docker run -d -p 9001:7001 -p 9002:9002 --name ${adminhost} --hostname ${adminhost} -v ${scriptDir}/properties:/u01/oracle/properties -v ${domainhostvol}:/u01/oracle/user_projects/domains ${ENV_ARG} 12214-weblogic-domain-generic
List of required images
[dave@localhost 12214-domain-generic]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
12214-weblogic-domain-generic latest 93dc22395c42 14 seconds ago 1.26GB
oracle/weblogic 12.2.1.4-generic b67e91a22473 46 seconds ago 1.26GB
<none> <none> ba227fc7cf16 About a minute ago 2.99GB
oracle/serverjre 8 639ea570f133 4 hours ago 356MB
oraclelinux 7-slim 874477adb545 2 months ago 118MB
Create directory on localhost where the Docker domain volume will be mapped - in our test /app/domains/
Run the domain
[dave@localhost 12213-domain]$ ./run_admin_server.sh
Context for docker build is /git/docker-images/OracleWebLogic/samples/12213-domain
Export environment variables from the /git/docker-images/OracleWebLogic/samples/12213-domain/properties/domain.properties properties file
env_arg: CUSTOM_DOMAIN_NAME=daveDomain
env_arg: CUSTOM_ADMIN_NAME=admin
env_arg: CUSTOM_ADMIN_PORT=7001
env_arg: CUSTOM_ADMIN_HOST=AdminContainer
env_arg: CUSTOM_MANAGED_SERVER_PORT=8001
env_arg: CUSTOM_MANAGED_SERVER_NAME_BASE=MS
env_arg: CUSTOM_CONFIGURED_MANAGED_SERVER_COUNT=2
env_arg: CUSTOM_CLUSTER_NAME=clusterdave
env_arg: CUSTOM_CLUSTER_TYPE=DYNAMIC
env_arg: CUSTOM_PRODUCTION_MODE_ENABLED=true
env_arg: CUSTOM_DOMAIN_HOST_VOLUME=/app/domains/
The domain configuration will get persisted in the host volume: /app/domains/
docker run -d -p 9001:7001 -p 9002:9002 --name AdminContainer --hostname AdminContainer -v /git/docker-images/OracleWebLogic/samples/12213-domain/properties:/u01/oracle/properties -v /app/domains/:/u01/oracle/user_projects/domains -e CUSTOM_DOMAIN_NAME=daveDomain -e CUSTOM_ADMIN_NAME=admin -e CUSTOM_ADMIN_PORT=7001 -e CUSTOM_ADMIN_HOST=AdminContainer -e CUSTOM_ADMIN_HOST=AdminContainer -e CUSTOM_MANAGED_SERVER_PORT=8001 -e CUSTOM_MANAGED_SERVER_NAME_BASE=MS -e CUSTOM_CONFIGURED_MANAGED_SERVER_COUNT=2 -e CUSTOM_CLUSTER_NAME=clusterdave -e CUSTOM_CLUSTER_TYPE=DYNAMIC -e CUSTOM_PRODUCTION_MODE_ENABLED=true 12214-weblogic-domain-slim
42999c43bffe7bd381031c07567d4aa9893a23247190cbdb18659cae9c228b33
[dave@localhost 12213-domain]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
42999c43bffe 12214-weblogic-domain-slim "/u01/oracle/contain…" 5 seconds ago Up 3 seconds 0.0.0.0:9002->9002/tcp, 0.0.0.0:9001->7001/tcp AdminContainer
[dave@localhost 12213-domain]$ pgrep -a java
7367 /usr/java/jdk-8/bin/java -server -Djava.security.egd=file:/dev/./urandom -cp /u01/oracle/wlserver/server/lib/weblogic-launcher.jar -Dlaunch.use.env.classpath=true -Dweblogic.Name=admin -Djava.security.policy=/u01/oracle/wlserver/server/lib/weblogic.policy -Doracle.jdbc.fanEnabled=false -Dweblogic.StdoutDebugEnabled=false -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader -javaagent:/u01/oracle/wlserver/server/lib/debugpatch-agent.jar -da -Dwls.home=/u01/oracle/wlserver/server -Dweblogic.home=/u01/oracle/wlserver/server weblogic.Server
[dave@localhost 12213-domain]$ ls /app/domains/
daveDomain
Deploy the application code using Maven
Set the latest version of weblogic-maven-plugin
<plugin>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>12.2.1-4-0</version>
Maven plugin goals
https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/wlprg/maven.html#GUID-CE12CFF4-EB0C-4E92-A13A-676AAD854663
SSH into container to check upload
docker exec -it 2f1af983d72d /bin/bash
Configure upload in Maven weblogic plugin
WAR is uploaded into Docker domain
[oracle@AdminContainer /]$ find . -name "rs-api.war" 2>/dev/null
./u01/oracle/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/rs-api/m49v6j/META-INF/.WL_internal/cache/rs-api.war
./u01/oracle/user_projects/domains/daveDomain/servers/admin/upload/rs-api/app/rs-api.war
./u01/oracle/user_projects/domains/daveDomain/servers/admin/tmp/.appmergegen_1572188440153_rs-api.war/META-INF/.WL_internal/cache/rs-api.war
./u01/oracle/user_projects/domains/daveDomain/servers/admin/tmp/.appmergegen_1572188440153/rs-api.war
./u01/oracle/user_projects/domains/daveDomain/servers/admin/tmp/_WL_user/rs-api/w7yf0e/META-INF/.WL_internal/cache/rs-api.war
Without upload you get following error
ERROR] Failed to execute goal com.oracle.weblogic:weblogic-maven-plugin:12.2.1-4-0:deploy (default) on project rs-api: weblogic.management.ManagementException: [Deployer:149003]Unable to access application source information in "/app/domains/apps/rs-api.war" for application "rs-api". The specific error is: No application files exist.
[ERROR] at weblogic.deploy.internal.adminserver.operations.OperationHelper.validateSource(OperationHelper.java:358)
[ERROR] at weblogic.deploy.internal.adminserver.operations.OperationHelper.getArchiveVersionIdFromSource(OperationHelper.java:168)
[ERROR] at weblogic.deploy.internal.adminserver.operations.OperationHelper.getAndValidateVersionIdWithSrc(OperationHelper.java:206)
in case of unreachable admin you can try to add JAVA Option with the flag “-Dweblogic.rjvm.enableprotocolswitch=true”
See also https://github.com/oracle/docker-images/issues/575
<plugin>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>12.2.1-4-0</version>
<!--
You can find and redefine the following variables in the parent pom file arccording to your environment.
oracleMiddlewareHome
oracleServerUrl
oracleUsername
oraclePassword
oracleServerName
-->
<configuration>
<middlewareHome>${oracleMiddlewareHome}</middlewareHome>
</configuration>
<executions>
<!--Deploy the application to the server-->
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<!--The admin URL where the app is deployed. Here use the plugin's default value t3://localhost:7001-->
<adminurl>${oracleServerUrl}</adminurl>
<user>${oracleUsername}</user>
<password>${oraclePassword}</password>
<!--The location of the file or directory to be deployed-->
<source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
<!--The target servers where the application is deployed. Here use the plugin's default value AdminServer-->
<!--targets>${oracleServerName}</targets-->
<verbose>true</verbose>
<!--The deployment name of the application-->
<name>${project.build.finalName}</name>
<upload>true</upload>
</configuration>
</execution>
</executions>
</plugin>
Deploy the app into Docker Weblogic domain
Sample application code is here https://github.com/dveselka/weblogic/tree/master/rs-apidave@localhost rs-api]$ mvn clean package pre-integration-test
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.dave:rs-api >---------------------------
[INFO] Building rs-api 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ rs-api ---
[INFO] Deleting /git/weblogic/rs-api/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rs-api ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /git/weblogic/rs-api/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ rs-api ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 4 source files to /git/weblogic/rs-api/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ rs-api ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /git/weblogic/rs-api/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ rs-api ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ rs-api ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ rs-api ---
[INFO] Packaging webapp
[INFO] Assembling webapp [rs-api] in [/git/weblogic/rs-api/target/rs-api]
[INFO] Processing war project
[INFO] Copying webapp resources [/git/weblogic/rs-api/src/main/webapp]
[INFO] Webapp assembled in [15 msecs]
[INFO] Building war: /git/weblogic/rs-api/target/rs-api.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rs-api ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /git/weblogic/rs-api/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ rs-api ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 4 source files to /git/weblogic/rs-api/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ rs-api ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /git/weblogic/rs-api/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ rs-api ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ rs-api ---
[INFO] No tests to run.
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ rs-api ---
[INFO] Packaging webapp
[INFO] Assembling webapp [rs-api] in [/git/weblogic/rs-api/target/rs-api]
[INFO] Processing war project
[INFO] Copying webapp resources [/git/weblogic/rs-api/src/main/webapp]
[INFO] Webapp assembled in [2 msecs]
[INFO] Building war: /git/weblogic/rs-api/target/rs-api.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] --- weblogic-maven-plugin:12.2.1-4-0:deploy (default) @ rs-api ---
[INFO] Command flags are: -noexit -deploy -username myusername -password ******* -name rs-api -source /git/weblogic/rs-api/target/rs-api.war -upload -verbose -adminurl t3://localhost:9001
weblogic.Deployer invoked with options: -noexit -deploy -username myusername -name rs-api -source /git/weblogic/rs-api/target/rs-api.war -upload -verbose -adminurl t3://localhost:9001
<Oct 27, 2019 2:12:33 PM CET> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, rs-api [archive: /git/weblogic/rs-api/target/rs-api.war], to configured targets.>
Task 5 initiated: [Deployer:149026]deploy application rs-api on admin.
Task 5 completed: [Deployer:149026]deploy application rs-api on admin.
Target state: deploy completed on Server admin
Target Assignments:
+ rs-api admin
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.768 s
[INFO] Finished at: 2019-10-27T14:12:34+01:00
[INFO] ------------------------------------------------------------------------
Check the running domain
[dave@localhost rs-api]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2f1af983d72d 12214-weblogic-domain-generic "/u01/oracle/contain…" 22 minutes ago Up 22 minutes 0.0.0.0:9002->9002/tcp, 0.0.0.0:9001->7001/tcp AdminContainer
[dave@localhost rs-api]$ pgrep -a java
25383 /usr/java/jdk-8/bin/java -Djava.security.manager -Djava.security.policy=/u01/oracle/wlserver/common/derby/derbyServer.policy -Dderby.system.home=/u01/oracle/user_projects/domains/daveDomain/common/db -classpath /u01/oracle/wlserver/common/derby/lib/derby.jar:/u01/oracle/wlserver/common/derby/lib/derbynet.jar:/u01/oracle/wlserver/common/derby/lib/derbytools.jar:/u01/oracle/wlserver/common/derby/lib/derbyoptionaltools.jar:/u01/oracle/wlserver/common/derby/lib/derbyclient.jar org.apache.derby.drda.NetworkServerControl start
25384 /usr/java/jdk-8/bin/java -server -Djava.security.egd=file:/dev/./urandom -cp /u01/oracle/wlserver/server/lib/weblogic-launcher.jar -Dlaunch.use.env.classpath=true -Dweblogic.Name=admin -Djava.security.policy=/u01/oracle/wlserver/server/lib/weblogic.policy -Doracle.jdbc.fanEnabled=false -Dweblogic.StdoutDebugEnabled=false -Dweblogic.rjvm.enableprotocolswitch=true -Djava.system.class.loader=com.oracle.classloader.weblogic.LaunchClassLoader -javaagent:/u01/oracle/wlserver/server/lib/debugpatch-agent.jar -da -Dwls.home=/u01/oracle/wlserver/server -Dweblogic.home=/u01/oracle/wlserver/server weblogic.Server
Test the app
[dave@localhost rs-api]$ curl http://localhost:9001/rs-api/resources/persons
[{"age":50,"name":"dave"},{"age":30,"name":"abc"}