🔗 Integrate Apache Web Server and Oracle Weblogic Application Server
Note: This post was originally published in 2014. While the core concepts remain valid, modern deployments often use containerization (Docker) and cloud-native solutions. However, the principles of load balancing and reverse proxy configuration remain fundamental.
In this interesting post, we will discuss how to integrate Oracle WebLogic Application Server with Apache Web (HTTP) Server in a detailed manner.
What is the Main Use of Oracle WebLogic Web Server Plugins?
- Oracle WebLogic Web Server Plug-Ins are plugins for popular Web Servers like Apache HTTP Server, iPlanet Web Server, Microsoft Internet Information Server (IIS).
- This plugin diverts the incoming HTTP(s) requests within the Web Server and reverse proxies the incoming requests across WebLogic Server Clusters.
Prerequisites
- Download and Install Apache Web Server (2.2)
- Download and Install Oracle WebLogic Server 12c
- Download Oracle WebLogic Web Server Plugins
- Deploy some sample Web Applications to the application server cluster environments
Steps Involved
Step 1: Download the Oracle WebLogic Web Server Plugin
Download the Oracle WebLogic Web Server plugin from the Oracle website.
Step 2: Extract the Plugin Archive
Unzip the plugin downloaded. This archived file has plugins for all platforms (Linux, Solaris, AIX, HP-UX, Windows). Select the desired platform based on your needs. I'm using Apache Web Server which is running on a Linux machine, so the following is the desired plugin I'm looking for:
WLSPlugin12c-64bit-Apache2.2-Linux64-x86_64.zip
Step 3: Extract Platform-Specific Plugin
Now unarchive the WLSPlugin12c-64bit-Apache2.2-Linux64-x86_64.zip
file.
Step 4: Copy Plugin Files to Apache
Copy the mod_wl.so
to the modules folder of the Apache web server.
cp mod_wl.so /usr/local/apache2/modules/
Step 5: Copy Oracle Libraries
Copy the libclntsh.so
and libnnz11.so
files to the lib folder of the Apache web server.
cp libclntsh.so /usr/local/apache2/lib/ cp libnnz11.so /usr/local/apache2/lib/
Step 6: Configure Apache Web Server
The plugin installation setup part is done. Now we need to proceed with the configuration part:
- Load the
mod_wl.so
module to the Apache Web Server - Set all the required web server parameters
- Get the application servers IP Address and Port numbers
Applications are deployed to the 3 managed servers mentioned above. So now specify that in theWebLogicCluster
parameters list as 192.168.56.1:7001,192.168.56.1:4003
and192.168.56.1:4005
. Use the same Context root (/Monitoring_Application
) that we mentioned in application.xml deployment descriptors in the <Location>
tag.
Step 7: Create Plugin Configuration File
Create a mod_wl.conf
file with the following configuration:
LoadModule weblogic_module modules/mod_wl.so <Location /Monitoring_Application> SetHandler weblogic-handler WebLogicCluster 192.168.56.1:7001,192.168.56.1:4003,192.168.56.1:4005 Debug ON WLLogFile /usr/local/apache2/logs/weblogic.log </Location> <Location /Monitoring_Application/*> SetHandler weblogic-handler WebLogicCluster 192.168.56.1:7001,192.168.56.1:4003,192.168.56.1:4005 Debug ON WLLogFile /usr/local/apache2/logs/weblogic.log </Location>
Step 8: Include Plugin Configuration in Apache
Include the mod_wl.conf
in the main Apache httpd.conf
file.
# Include WebLogic plugin configuration Include conf/mod_wl.conf
Step 9: Restart Apache Web Server
In order for the changes to take effect, restart the Apache web server.
/usr/local/apache2/bin/apachectl restart
Step 10: Test the Integration
Access the web application deployed to Oracle WebLogic Application Server using the Apache Web Server.
- Using Application Server's IP_Address:Port
- Through Apache Web Server IP_Address:Port
Now the incoming HTTP(s) requests within the Apache Web Server are reverse proxied across WebLogic Server Clusters 192.168.56.1:7001
, 192.168.56.1:4003
& 192.168.56.1:4005
automatically by the web server.
Complete Configuration Example
Here's a complete example of the Apache configuration:
# Apache httpd.conf ServerRoot "/usr/local/apache2" Listen 80 LoadModule mpm_prefork_module modules/mod_mpm_prefork.so LoadModule dir_module modules/mod_dir.so LoadModule mime_module modules/mod_mime.so LoadModule weblogic_module modules/mod_wl.so ServerName localhost DocumentRoot "/usr/local/apache2/htdocs" <Directory /> AllowOverride none Require all denied </Directory> <Directory "/usr/local/apache2/htdocs"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> # Include WebLogic plugin configuration Include conf/mod_wl.conf ErrorLog "logs/error_log" LogLevel warn <IfModule log_config_module> LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined LogFormat "%h %l %u %t "%r" %>s %b" common CustomLog "logs/access_log" combined </IfModule>
Advanced Configuration Options
Additional configuration options for the WebLogic plugin:
<Location /Monitoring_Application> SetHandler weblogic-handler WebLogicCluster 192.168.56.1:7001,192.168.56.1:4003,192.168.56.1:4005 # Connection timeout (in seconds) ConnectTimeoutSecs 10 # Read timeout (in seconds) ReadTimeoutSecs 60 # Keep alive timeout (in seconds) KeepAliveSecs 60 # Maximum number of connections MaxConnections 100 # Debug level (OFF, ON, ERR, EMERG, ALERT, CRIT, ERR, WARN, NOTICE, INFO, DEBUG) Debug ON # Log file location WLLogFile /usr/local/apache2/logs/weblogic.log # SSL configuration (if using HTTPS) # WLProxySSL ON # WLProxySSLPassThrough ON </Location>
Load Balancing Configuration
For better load balancing, you can configure multiple clusters:
# Primary cluster <Location /Monitoring_Application> SetHandler weblogic-handler WebLogicCluster 192.168.56.1:7001,192.168.56.1:4003,192.168.56.1:4005 Debug ON WLLogFile /usr/local/apache2/logs/weblogic.log </Location> # Backup cluster <Location /Monitoring_Application/backup> SetHandler weblogic-handler WebLogicCluster 192.168.56.2:7001,192.168.56.2:4003,192.168.56.2:4005 Debug ON WLLogFile /usr/local/apache2/logs/weblogic_backup.log </Location>
SSL Configuration
To enable SSL termination at Apache:
LoadModule ssl_module modules/mod_ssl.so <VirtualHost *:443> ServerName your-domain.com DocumentRoot "/usr/local/apache2/htdocs" SSLEngine on SSLCertificateFile /path/to/certificate.crt SSLCertificateKeyFile /path/to/private.key <Location /Monitoring_Application> SetHandler weblogic-handler WebLogicCluster 192.168.56.1:7001,192.168.56.1:4003,192.168.56.1:4005 WLProxySSL ON WLProxySSLPassThrough ON Debug ON WLLogFile /usr/local/apache2/logs/weblogic_ssl.log </Location> </VirtualHost>
Monitoring and Troubleshooting
Key files and commands for monitoring:
- Apache Error Log:
/usr/local/apache2/logs/error_log
- WebLogic Plugin Log:
/usr/local/apache2/logs/weblogic.log
- Apache Access Log:
/usr/local/apache2/logs/access_log
- Test Configuration:
apachectl configtest
- Check Module Loading:
apachectl -M | grep weblogic
Benefits of Apache-WebLogic Integration
- Load Balancing: Distributes requests across multiple WebLogic instances
- SSL Termination: Handle SSL at Apache level for better performance
- Static Content Serving: Serve static files directly from Apache
- Security: Additional security layer and access control
- Monitoring: Centralized logging and monitoring
- High Availability: Failover capabilities across multiple servers
Modern Alternatives
While this approach is still valid, modern alternatives include:
- Docker Containers: Containerized deployments with Docker
- Kubernetes: Container orchestration with built-in load balancing
- Cloud Load Balancers: AWS ALB, Azure Application Gateway, GCP Load Balancer
- NGINX: Modern web server with better performance
- Traefik: Cloud-native reverse proxy and load balancer
- Istio: Service mesh for microservices
Best Practices
- Health Checks: Implement health check endpoints
- Connection Pooling: Configure appropriate connection pool sizes
- Timeout Configuration: Set appropriate timeout values
- Logging: Enable detailed logging for troubleshooting
- Security: Use HTTPS and implement proper security headers
- Monitoring: Set up monitoring and alerting
Key Takeaways
- Apache-WebLogic integration provides load balancing and reverse proxy capabilities
- Proper plugin configuration is essential for successful integration
- SSL termination at Apache level improves performance
- Monitoring and logging are crucial for troubleshooting
- Modern alternatives offer more flexibility and scalability