So this Friday the 9th of December we saw the release of Oracle’s next generation application server: Weblogic 12c. Well, at least the development version. It has slimmed down a lot, which is good, and has some nice new features. Installing it is super easy, just follow the instructions from the included README.txt, or read some of the bazillion blog posts about installing this version of Weblogic.
However, do we notice the “c”? Doesn’t this “c” stand for cloud? So let’s do something interesting with it. In this post I’ll show you how to run Weblogic 12c directly on your hypervisor in Oracle VM.
- Make sure you have read my previous blog post about Jrockit VE, because it will be more or less the same.
- Download the JRockit VE edition (with the included WLS 11g) from the link on this blog post.
- Download 12c.
Now let’s create the base package for WLS 12c. For sake of simplicity, we will just create a basic domain. In my examples I assume a Linux system.
Unpack the downloaded ZIP (wls1211_dev.zip) in /wls12c (yes in the root file system!) .
#as root su - mkdir /wls12 cd /wls12c unzip <path to your zip>/wls1211_dev.zip
Now create a basic domain (“mydomain”). Just follow the included instructions in the README.txt that is included. Basically it boils down to:
# STILL AS ROOT export JAVA_HOME=<path to your JAVA JDK install> export MW_HOME=/wls12c cd /wls12c ./configure.sh . $MW_HOME/wlserver/server/bin/setWLSEnv.sh mkdir /wls12c/mydomain cd /wls12c/mydomain $JAVA_HOME/bin/java $JAVA_OPTIONS -Xmx1024m -Dweblogic.management.allowPasswordEcho=true weblogic.Server # Follow the instructions and CTRL-C when the server starts
So, now we have a basic domain. Let’s continue with JRockit VE. The following instructions will look a lot like a previous blog post by yours truly.
Get the wlsvePackage.zip which includes the jrockit virtual edition. Unpack it somewhere, let’s say in /tmp/wlsve
# AS ROOT mkdir /tmp/wlsve cd /tmp/wlsve unzip <path to the zip>/wlsvePackage.zip
Now get the config of this JRockitVE image, we will need it later:
# In /tmp/wlsve $JAVA_HOME/bin/java -jar wlsveimagetool.jar -r ./wlsve/vm.cfg get config config.xml
The wlsvePackage.zip comes with the Weblogic 11g (10.3.2). We don’t what that version, so we are going to remove it. We are only interested in the Jrockit virtual edition. Therefore, we will first mount the image:
# If the mount directory doesn't exist: mkdir /mnt/sysimg mount -o loop=/dev/loop0 /tmp/wlsve/wlsve/system.img /mnt/sysimg
Get rid of the “old” version of Weblogic by removing the application directory:
rm -rf /mnt/sysimg/application
Now copy the fresh and new 12c version to the VM’s root:
mkdir /mnt/sysimg/wls12c cd /mnt/sysimg/wls12c cp -R /wls12c/* .
And this is why we created the domain in de root “/” directory: it will become the root in the VM image. Basically I’m just lazy here
Now for the hardest part. the Jrockit VE will not start the WLS domain by running the well known “startWeblogic.sh” bash script. We need to “reverse engineer” the Java command to start Weblogic. Basically just see which java command startWeblogic.sh creates and add the classpath (-cp) to it. We have to put this command in the config.xml we’ve created earlier with the wlsveimagetool.jar.
With this, the config.xml will be:
<?xml version="1.0" encoding="UTF-8"?> <jrockitve-imagetool-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="jrockitve-imagetool-config.xsd" version="5.1"> <jrockitve-config memory="1024" cpus="1"> <storage> <disks> <disk id="root" size="1024 MB"/> </disks> <mounts> <mount> <mount-point>/</mount-point> <disk>root</disk> </mount> </mounts> </storage> <vm-name>wlsve_12c</vm-name> <working-dir>/wls12c/mydomain</working-dir> <java-arguments> -cp $JAVA_HOME/lib/tools.jar:/wls12c/wlserver/server/lib/weblogic_sp.jar:/wls12c/wlserver/server/lib/weblogic.jar:/wls12c/modules/features/weblogic.server.modules_188.8.131.52.jar:/wls12c/wlserver/server/lib/webservices.jar:/wls12c/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/wls12c/modules/net.sf.antcontrib_184.108.40.206_1-0b2/lib/ant-contrib.jar -Xms512m -Xmx512m -Dweblogic.Name=myserver -Djava.security.policy=/wls12c/wlserver/server/lib/weblogic.policy -Djava.endorsed.dirs=/root/oracle/jrockit/jre/lib/endorsed:/wls12c/wlserver/endorsed -Xverify:none -Djava.endorsed.dirs=$JAVA_HOME/jre/lib/endorsed:/wls12c/wlserver/endorsed -da -Dplatform.home=/wls12c/wlserver -Dwls.home=/wls12c/wlserver/server -Dweblogic.home=/wls12c/wlserver/server -Dweblogic.management.discover=true -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= weblogic.Server</java-arguments> <network> <nics> <nic type="bridged"/> </nics> </network> <locale-data> <locale>en_US</locale> <timezone>Europe/Amsterdam</timezone> <encoding>ISO-8859-1</encoding> </locale-data> </jrockitve-config> </jrockitve-imagetool-config>
Note that the working-dir has to be the domain directory. “/wls12c/mydomain” in our case. Also note the memory settings of the jrockitve-config/@memory: make this memory setting at least 256MB higher as the -Xmx you’ve set in the Java options. (In my example I’m being generous ). If you give it less, the garbase collector will crash with an out of memory error.
Ok, now we’re done with the image. Unmount it:
cd umount /mnt/sysimg
Let’s insert the config we’ve created earlier.
cd /tmp/wlsve $JAVA_HOME/bin/java -jar wlsveimagetool.jar -r ./wlsve/vm.cfg set config config.xml
Et voila! Now we have our base VM image for in the cloud. Copy the vm.cfg and the system.img to your Oracle VM Server. Remember to edit the vm.cfg to reflect the actual path on the /OVS !
You can run the VM by issuing the following command as root on dom0:
xm create -c vm.cfg
So now what?
By packaging this base (or some other more elaborate) domain we have just created, and maybe scripting the config settings using the wlsveimagetool, you can supply your organisation with an application server within minutes, all running on your own Oracle VM cloud clusters. I guess this is what Oracle themselves do with their Java Public Cloud service.Running Weblogic 12c as it is meant to be: in the Cloud,