-1

when I use ajp connector with apache server and tomcat. I did follow link: https://www.ntu.edu.sg/home/ehchua/programming/howto/ApachePlusTomcat_HowTo.html

But there is an error:

httpd: Syntax error on line 424 of /opt/httpd-2.2.31/conf/httpd.conf
: Syntax error on line 3 of /opt/apache-tomcat-8.0.30/conf/mod_jk.conf
: Cannot load /opt/httpd-2.2.31/modules/mod_jk.so into server
: /opt/httpd-2.2.31/modules/mod_jk.so: invalid ELF header

Anybody can help me. Please Thanks

Harry
  • 1
  • 1
  • 2
  • Your mod_JK seems to be defective. Run cat mod_JK.so | hexdump -C and show us the output. Perhaps it is a zip or html file, this happens sometimes during downloads – Marged Jan 12 '16 at 07:23
  • One more question: which Linux do you use ? Did you install Apache and Tomcat using that distros package manager ? If not I suggest you change this and use a2enmod to enable mod-jk. Besides that you should consider using Apache 2.4. Please update your question accordingly. And you should copy the relevant parts of your configuration into the question because link-only questions are not very welcome on SO. – Marged Jan 12 '16 at 07:33
  • I use Sentos os and install apache + tomcat – Harry Jan 12 '16 at 07:47
  • It's called Centos. Which version ? Please remove your answer and add the details to your question, use the edit button for this. Where is the output from hexdump ? – Marged Jan 12 '16 at 07:48

1 Answers1

0

Apache is complaning about an invalid .so file:

: Cannot load /opt/httpd-2.2.31/modules/mod_jk.so into server 
: /opt/httpd-2.2.31/modules/mod_jk.so: invalid ELF header

There can be many reasons for this, perhaps you accidentally downloaded a zip file and forgot to unpack it or while downloading your browser received a html error page.

To check if your file is a valid binary you can check its content:

cat mod_jk.so | hexdump -C | more

This should return something similar to this and the magic bytes "ELF" need to be shown: Example ELF binary

If you see PK or html this is proof for my theory I mentioned above.

Regardless of this I suggest you choose the "official" way of installing and enabling apache modules specific to CentOS. Siteloading other binaries will cause problems because modules don't match the version of Apache you use. And if you have no specific reasons for using mod_jk you should consider switching to mod_proxy.

Marged
  • 10,577
  • 10
  • 57
  • 99
  • Hello Marged , I downloaded file mod_jk.so at link http://mirrors.viethosting.vn/apache/tomcat/tomcat-connectors/jk/binaries/windows/ ? I think it support for windows not nilux.. – Harry Jan 12 '16 at 08:39
  • my file mod_jk.so it diff with you . Please see updating below. Can you send me mod_jk.so file right? Thanks – Harry Jan 12 '16 at 08:50
  • Can you send me this file mod_jk.so ? Please .. my email : nvtamcntt@gmail.com – Harry Jan 12 '16 at 09:06