Friday, November 16, 2012

Apache and mod_jk on Mountain Lion

(I haven't been using this space for anything else lately, so I may as well save some handy stuff relating to development and computer stuff (and anything else, really).)

I upgraded to Mountain Lion tonight, and upon doing so I found the ability to start and stop the apache server had been moved out of the preferences. So another tool on the command line.

sudo apachectl start
sudo apachectl stop
sudo apachectl restart

 My apache server starts automatically, for whatever reason, but those are the commands to do so manually. Additionally, since I found that some of the configuration settings in apache before break the current, the following was useful to troubleshoot why apache wouldn't start correcty: 

sudo apachectl -t

That will start the server but spit out any errors that are thrown.

The next hurdle was mod_jk, the connector that passes calls from apache to tomcat where applicable. I have found that whenever I change OS X versions, the mod_kj connector needs to be re-built. Copying across won't suffice, either. So I got the latest connector source files from here: http://tomcat.apache.org/download-connectors.cgi

Then I updated my XCode in the Apple App Store. XCode has the compile tools you will need. There was a "gotcha" in this part, though. For some reason, the XCode tools are not in the place they are expected, so I had to run the following to link the tools to the correct place:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain
(source: http://apple.stackexchange.com/questions/58186/how-to-compile-mod-wsgi-mod-fastcgi-etc-on-mountain-lion-by-fixing-apxserror)

For me that got rid of the problems I came across when running the following to build and install mod_jk: 
cd native
./configure CFLAGS='-arch x86_64' APXSLDFLAGS='-arch x86_64' --with-apxs=/usr/sbin/apxs
make
sudo make install
(source: http://www.bartbusschots.ie/blog/?p=1347)

So that got my java web stuff back working again. I will probably find more issues to contend with from installing Mountain Lion. But the iMessage for mac is suppose to be cool and I expect it to be useful. Worth it?

(More Info: Once I did get things (seemingly) working, I did find that my tomcat was acting up. Every time I loaded a page for the first time, tomcat would no longer respond. So I could browse among pages I had loaded recently just fine (albeit slowly), but if I went to load a new page, then things would freeze up. No logs or any other clue as to why. I ended up replacing my tomcat with a new version (7.0.32) and things started working again as I expected. No telling why all this happened, and I just don't have the time (nor really the inclination) to track down why. I'm just glad to be moving again.)

No comments: