How to install tomcat mod_jk on Mac OS X Leopard
You’d think this would be easy, but you’d be wrong. I was.
First, the config files have moved. They are not in /etc/httpd anymore. They are in /etc/apache2. Great. But that was the easy part.
I followed similar instructions to my previous method for Tiger, but if you do that, you get this in your system.log when you restart Apache:
/private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_jk.so into server: dlopen(/usr/libexec/apache2/mod_jk.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/mod_jk.so: mach-o, but wrong architecture
I checked the architecture of the mod_jk.so. It said i386. Whaa??? An Intel Mac won’t load an i386 file in Leopard? (Sad face here). OK, fine, all I have to do is is compile with gcc with the right flags. What are those?
-arch x86_64
But that’s not the whole deal, because I use apxs to do the compiling, so you actually have to hack up the Makefile.apxs magic line. In particular, after you generate Makefile.apxs, edit it like this:
mod_jk.la:
$(APXS) -c -o $@ -Wc,"${APXSCFLAGS} -arch x86_64 ${JK_INCL}" "${JAVA_INCL}" "${APXSLDFLAGS} -arch x86_64 " mod_jk.c ${APACHE_OBJECTS}
Then your apache should at least load, and you can configure the rest.
October 29th, 2007 at 11:31 pm
Great post here! Without your investigation into the solution, I’d have been completely lost. I did have to do a little extra work figuring out that I needed to tell make to use the apache-2.0/Makefile.apxs for the build though. However, once that’s done, it installs as it should.
November 25th, 2007 at 5:09 pm
Just wanted to note that apache2 on Leopard includes mod_proxy_ajp,
which seems to be easier to configure.
Simply create a file ajp.conf in /etc/apache2/other/ containing following lines:
ProxyPass ajp://127.0.0.1:8009/yourpath
The file will be included at your next apache restart/reload.
November 25th, 2007 at 5:48 pm
Interesting. I’ll take a look at that. I guess I’ll have to come up with a different load balancing solution though.
Thanks!
January 12th, 2008 at 10:21 pm
For mod_proxy_ajp you need something like this right?
ProxyPass ajp://localhost:8009/yourpath/
Simply having the ProxyPass without a location is not enough… right?
I’m questioning ’cause Sigurd’s recommendation didn’t work for me (error reported in the system log), and my mod doesn’t work either!
Any further clues on getting mod_proxy working for ajp on Leopard?
January 12th, 2008 at 10:24 pm
Hang on, this blog isn’t allowing my markup to be submitted properly, what I meant to state was:
<Location /yourpath/>
ProxyPass ajp://localhost:8009/yourpath/
</Location>
I suspect that Sigurd’s original post was trying to specify the Location elements also. Still, the above isn’t quite working for me. Any further ideas?
January 13th, 2008 at 7:25 am
Yes, you would definitely need a location for proxypass to work.
I haven’t tried it (using proxypass) myself, since I’ve been happily using mod_jk that I built as outlined in the original post.
April 13th, 2008 at 4:41 pm
hello, if your on leopard your apache2 needs to be told what layout it should use, so when you do a config doing something like:
./configure -enable-layout=Darwin -my-other-options
and it will realise your on a mac and stop asking about i386..
June 3rd, 2008 at 5:42 pm
Try this configure command, it worked for me and you don’t have to hack any files:
./configure CFLAGS=’-arch x86_64′ APXSLDFLAGS=’-arch x86_64′ –with-apxs=/usr/sbin/apxs
October 22nd, 2008 at 10:20 am
Configuring for Apache, Version 1.3.41
+ using installation path layout: Darwin (config.layout)
configure:Error: invalid option ‘CFLAGS=’-arch’
dosen’t work!
October 22nd, 2008 at 11:13 am
I’ve completely switched over to using mod_proxy, mod_jk is just too painful for a simple desktop configuration.
November 14th, 2008 at 11:31 pm
[...] http://egopoly.com/2007/10/29/how-to-install-tomcat-mod_jk-on-mac-os-x-leopard/ [...]