Copy roundrobin.c from appserver_install_dir/lib/install/templates to a work directory (for example:/home/user/workspacelb).
Compile roundrobin.c with an ANSI C/C++ compiler (for example Sun Studio compiler or GCC). Be sure to build a dynamic shared library and not a static executable.
If you are using Sun Studio CC Compiler, use the following command to compile:
cc -G -I<appserver install dir>/lib/install/templates roundrobin.c -o roundrobin.so
If you are using GCC, compile the shared library with this command:
gcc -shared -I<appserver install dir>/lib/install/templates roundrobin.c -o roundrobin.so
If you encounter a relocation error, compile again using the option "-fPIC." The command will look like this:
gcc -shared -fPIC -I <appserver install dir>/lib/install/templates roundrobin.c -o roundrobin.so
On Microsoft Windows, download the Cygwin utility from http://www.redhat.com/services/custom/cygwin. This utility has GCC bundled with it. Use the following GCC command to create a dynamic link library (dll):
gcc -shared -I<appserver_install_dir>/lib/install/templates roundrobin.c -o roundrobin.dll
Change loadbalancer.xmlto point to the newly built module. This is how loadbalancer.xml will look after the edit.
<cluster name="cluster1" policy="user-defined" policy-module="home/user/workspacelb/roundrobin.so">
Copy roundrobin.so to the web server instance directory.
Start the web server if it is not running or wait till the load balancer is re-configured.