CentOS 7下Apache httpd无法加载WebLogic插件库问题求助
Background
I was working on configuring Apache HTTP Server to route traffic to WebLogic using the official plugin, following Oracle's recommended practices. Initially, I tested the 12c (12.1.2) plugin, but it had critical issues with AJAX requests that occasionally caused session invalidation. Switching to the newer 12.2.1.2.0 plugin seemed like the right fix, but I hit a dependency error even after placing all library files in /usr/local/lib, setting correct ownership (root:root) and permissions (755), and adding the module load directive LoadModule weblogic_module /usr/local/lib/mod_wl_24.so in /etc/httpd/conf.modules.d/00-base.conf.
The exact error in httpd logs was:
Jan 06 16:22:49 centos.mywebsite.com.au httpd[4001]: httpd: Syntax error on line 58 of /etc/httpd/conf/httpd.conf: Syntax error on line 67 of /etc/httpd/conf.modules.d/00-base.conf: Cannot load /usr/local/lib/mod_wl_24.so into server: libopmnsecure.so: cannot open shared object file: No such file or directory
Even though libopmnsecure.so was in the same directory as mod_wl_24.so, and I had set environment variables like APACHE_HOME, JAVA_HOME, PLUGIN_HOME, and LD_LIBRARY_PATH as per the guide, the issue persisted. Here are the troubleshooting steps that resolved this for me:
Troubleshooting Steps
1. Ensure LD_LIBRARY_PATH is accessible to the httpd process
Apache HTTP Server doesn't inherit shell environment variables by default. If you set LD_LIBRARY_PATH in your user's .bashrc or /etc/profile, it won't be picked up when httpd starts as a system service.
Fix:
- Edit the httpd environment config file
/etc/sysconfig/httpd - Add these lines to explicitly set the library path for the httpd service:
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH - Restart httpd to apply changes:
systemctl restart httpd
2. Use ldd to verify dependency resolution
Run the ldd command on mod_wl_24.so to confirm exactly where it's looking for libopmnsecure.so:
ldd /usr/local/lib/mod_wl_24.so | grep libopmnsecure
If the output shows not found, this confirms the path isn't being recognized. If it shows the correct path, move to the next step.
3. Link plugin libraries to a system-standard directory
Some systems prioritize standard library paths like /usr/lib64 over custom paths like /usr/local/lib. Create symbolic links for all WebLogic plugin libraries to the system directory:
ln -s /usr/local/lib/libopmnsecure.so /usr/lib64/libopmnsecure.so ln -s /usr/local/lib/lib* /usr/lib64/
(Note: Adjust paths to /usr/lib if your system uses 32-bit libraries instead of 64-bit)
4. Check SELinux permissions
CentOS 7 has SELinux enabled by default, which might block httpd from accessing libraries in /usr/local/lib.
Fix:
- Temporarily set SELinux to permissive mode to test:
setenforce 0 - If httpd starts successfully, update SELinux policies to allow permanent access:
semanage fcontext -a -t httpd_sys_content_t "/usr/local/lib(/.*)?" restorecon -Rv /usr/local/lib - Re-enable SELinux with:
setenforce 1
5. Double-check plugin file permissions
Even if you set permissions earlier, file copies or system operations can reset them. Re-apply the correct permissions:
chown root:root /usr/local/lib/*.so chmod 755 /usr/local/lib/*.so
After trying these steps, my httpd service successfully loaded mod_wl_24.so, and the WebLogic plugin worked without the AJAX/session issues present in the older 12c version.
内容的提问来源于stack exchange,提问作者cidy.long

