Installing WordPress on Tomcat

WordPress 3.0.5 installs quite smoothly on Tomcat using Quercus for the PHP support, and runs fast!

However, we did run into a few problems at first which are covered below.

Getting Started

  • First, download and install Quercus, and make sure it's running properly. See Using PHP with Tomcat for how to do this.
  • Next download and unzip WordPress from http://wordpress.org/
  • Upload the files to the folder you created when installing Quercus (example: wp)
  • Access the application to start the installer, http://yoursite/wp
  • WordPress will ask you for the database connection details, a password, and the name of your new blog
  • Log in!

Known Issues

These are the problems we ran into when installing WordPress on Tomcat and how we solved them.

Known Issue - Admin page looks strange after a few clicks

After clicking a few things on the admin panel, suddenly the CSS went strange and it was impossible to work properly.

This is caused by WordPress compressing the CSS using GZip, even though it's already compressed at the Tomcat level. The double-compression causes the CSS to not download properly.

This can be fixed by changing a line in includes/script-loader.php but that's not very future-proof.

The best solution is to disable the setting via the database.

  • Solution: Connect to your database using phpmyadmin or some other method and run the following update statement:
UPDATE wp_options
SET option_value = 0
WHERE option_name = 'can_compress_scripts';

Known Issue - Installing Themes, Plugins and updates from the Admin Panel causes errors and corruption

If you've already done this, and now have a corrupted theme or plugin, simply delete it. WordPress notices it is gone, and goes back to the default theme.

The problem seems to be something to do with how the file downloads (perhaps because of Quercus).

  • Solution: install themes and plugins by downloading them yourself, and uploading them to the appropriate folder over FTP. See the instructions with each plugin for where to install it. For example, themes go in the wp-content/themes folder.

Mail Exception

On our first installation, everything seems ok, but on another when approving a comment WordPress was trying to send an email and was crashing when using the "Mail" version of the mailer...

java.lang.ArrayIndexOutOfBoundsException: 64 com.caucho.util.CharBuffer.deleteCharAt(CharBuffer.java:472)
com.caucho.quercus.lib.mail.MailModule.splitHeaders(MailModule.java:389) com.caucho.quercus.lib.mail.MailModule.mail(MailModule.java:76)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597)
com.caucho.quercus.module.StaticFunction.invoke(StaticFunction.java:135) com.caucho.quercus.env.JavaInvoker.callMethod(JavaInvoker.java:737)
com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:643) com.caucho.quercus.expr.CallExpr.evalImpl(CallExpr.java:237)
com.caucho.quercus.expr.CallExpr.evalCopy(CallExpr.java:164)

After some investigation, we put in a hack to change the method to SMTP, but then the headers were joined to the mail content and that resulted in empty emails being sent.

One more hack to add a CRLF, and all is good.

File changed: /wp-includes/class-phpmailer.php

Look for the line that says: /* Choose the mailer */, add review the changed lines below:

    $this->Mailer = 'smtp';  // Added - Hack: Neale - Force SMTP

    /* Choose the mailer */
    switch($this->Mailer) {
      case 'sendmail':
        $result = $this->SendmailSend($header, $body);
        break;
      case 'smtp':
        $result = $this->SmtpSend($header . chr(10) . chr(13), $body);  // Added an extra CRLF here with chr(10) and chr(13)
        break;
...

Other Issues

If you have anything to add, please mail us or update the wiki.

navigation
metawerx specific
search
Share
tools
help

referring pages

Share