Showing posts with label Tomcat. Show all posts
Showing posts with label Tomcat. Show all posts

Thursday, November 20, 2014

Setting JAVA_HOME for Bitnami Apache Tomcat stack as a Windows Service

tl;dr 

You can't set it to a different JAVA_HOME, you'll have to set your JAVA_HOME to the Bitnami JDK if you want a consistent JDK.

Setting the Bitnami Tomcat JAVA_HOME on Windows

The Problem

The Bitnami Tomcat stack packages it's own JDK and uses it over the existing JAVA_HOME directory.  This means that if you want a consistent JDK between your unit tests and in-container tests (and you do) you either need to set your usual JAVA_HOME to the Tomcat version or get Tomcat to use the system JAVA_HOME.

The Background

This tutorial is about the latter, as I have already installed the Java Cryptography Extension (JCE) unlimited strength jurisdiction policy files into the system JAVA_HOME (as per a blog post on Suhorish!) and didn't want to do it again.

The Research

After going through several stackoverflow questions and a Bitnami community post I found that they all suggested changing the various Windows BAT files in /bin and /scripts.  This did not work.

The Experiments

Digging into the Windows Service properties I found that the tomcat7.exe is called directly, therefore bypassing all of these scripts.

I eventually decided to use Junction Link Magic to create a hard link from Bitnami/tomcatstack/java to my actual JAVA_HOME... and that didn't work.  The Tomcat service will fail with Application Error 1 and an event error of:
The tomcatstackTomcat service terminated with the following service-specific error: 
Incorrect function.

So I tried to bypass the service by calling the scripts directly, also to no avail.

The Conclusion

This led me to the tl;dr at the start of this article.  I hate admitting defeat.

Wednesday, January 16, 2013

Wordpress & XAMPP

So, if you're not familiar XAMPP is an all-in-one solution running on multiple platforms (X), Apache, MySql, Perl and PHP (and Tomcat).  I've used this well for PHP development before back around 2006.

However when I went to use this to host a local Wordpress instance for development purposes I kept getting an invalid database connection message.  After hours of struggle and frustration, wikihow had a great article with a step by step tutorial on this.  It turned out my DB encoding was wrong (thanks regular tutorial and error messages for being so obtuse!).