Docker, Java EE 7, and Maven with WebLogic 12.1.3
By BrunoBorges-Oracle on Jun 30, 2014
UPDATE March 2015 - We now officially certify and support WebLogic 12.1.3 on Docker Containers! For more information see this blog post and this whitepaper on OTN. The Docker configuration files are also now maintained on the official Oracle GitHub Docker repository.
WebLogic 12.1.3 was released and with it the support for perhaps the most important Java EE 7 APIs for database-backed Web Applications development. These are the specifications supported in this release:
- Java Persistence API 2.1 (implemented by EclipseLink)
- JAX-RS 2.0 (implemented by Jersey)
- JSON-P 1.0 (implemented by GlassFish subproject jsonp)
- WebSockets 1.0 (implemented by Tyrus)
Getting started with WebLogic 12.1.3, Java EE 7, Maven, and Docker
- Extract the content in a folder where you want to hold the wls12130 directory that comes inside the ZIP file. On my Linux machine, I use /home/bruno/Work/tools/.
- Go to the wls12130 folder and run the configure.cmd (Windows) or configure.sh (Unix).
- Creating the domain may take too long and may be seen as the installer is freezed. Make sure to configure this if you are on Linux:
$ export CONFIG_JVM_ARGS=-Djava.security.egd=file:/dev/./urandom
Installing WebLogic 12.1.3 with Docker (easier)
- Download the ZIP or checkout the weblogic-docker Git repository and extract somewhere on your computer. I will use $DOCKER_HOME as a reference to that location.
- Copy the wls12130_dev.zip you download previously into $DOCKER_HOME/weblogic-docker/weblogic12c-zip/
- Call the build.sh script (as sudo) and wait for Docker to do its magic
- Call dockWebLogic.sh and see WebLogic going up and running on a Docker container.
- It will attach port 7001 to your host interfaces
Configuring your local Maven repository
- Go to the WebLogic home installation directory. For example:
$ cd /home/bruno/Work/wls12130/
- Go to the subdir
$ cd oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.3/
- Execute the following command:
$ mvn install:install-file -DpomFile=oracle-maven-sync-12.1.3.pom -Dfile=oracle-maven-sync-12.1.3.jar
- Finally you call the push command to upload all Maven artifacts (plugins, archetypes, etc) to your repository (local in this case)
$ mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=/home/bruno/Work/wls12130/
Create Java EE applications with WebLogic Maven Archetypes
mvn archetype:generate -DarchetypeGroupId=com.oracle.weblogic.archetype -DarchetypeArtifactId=basic-webapp -DarchetypeVersion=12.1.3-0-0 -DgroupId=org.mycompany -DartifactId=my-basic-webapp-project -Dversion=1.0-SNAPSHOT
mvn package pre-integration-test -DoracleUsername=weblogic -DoraclePassword=welcome1 -Dupload=true
Now open http://localhost:7001/basicWebapp and see this sample application up and running!