An easy and pre-packaged WAR to run WordPress in your preferred Java servlet container (es. Tomcat).

To run a wordpress inside an application server, you need few things:

  • Something that can interpret PHP
  • An application server
  • A MYSQL/MariaDB server

That’s a short list, and the first point, in a world where the JVM can already run python, ruby, javascript, etc, can lead us to think where’s an JPHP? Well actually seems that nobody in the Java or PHP community cares (really strange given how much love exists each other uh? :p)

Luckly there’s the more pragmatic Caucho (author of the Resin application server) that give us Quercus, a PHP5 Java implementation with a ready to use Servlet that does all the dirty job. All credits goes to Caucho and Quercus authors!

Look at the update post for version 4.4.1

So what I’ve done here is put all together, test it a bit and try to provide a WAR with all you need inside, and, why not, useful maven artifact for maximum reuse.



As an example, this could be your POM if you want a blog based on wordpress.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">








Well, if you can see this site the answer is: yes! After some tests (and after wordpress 4.1 that caused an infinite call recursion on blog with more than one page) I can say that all seems fine.

You can use the dashboards, change/configure themes, use plugins (jetpack, and code highlighters, as you can see) etc. Almost all the problems that I’ve encountered was fixed upgrading wordpress (so Quercus seems doing his job), except this:


  • Automatically install/upgrade themes and plugins from the dashboard: quercus doesn’t fully implement curl (seems a long time bug…) but maybe I can make a workaround for it. Anyway a wget and unzip from ssh does the job without hassle!
  • Permalinks: we don’t have here apache mod_rewrite. A filter can solve this, stay tuned.




The nerd/geek inside of me would answer: “because we can!”, and that’s a good reason for me. Other than that, this site is hosted on a Linode with 2GB of RAM and other services running on a simple Tomcat.
So why waste other memory with a “full compliant” Apache/PHP runtime, when I can use the already running JVM?


Hoping to not infringe some strange redistribute rights (come’n It’s all open-source here!), I plan to follow WordPress/Quercus releases and upgrade jwordpress, testing it for my use on this blog (with some help of technologies like Ansible… I’ll surely write my 2 cent on this)
The jwordpress version number will follow the wordpress version, with eventually a revision number if needed.

Thanks for reading, and happy blogging with JWordpress!

17 Responses to “JWORDPRESS

  • Hi, I’m a designer and work with developers. I’d like to run jWordpress but so far no luck.

    Here are the steps I did:
    1.- Import WAR, clicked Next
    2.- Deselect all, clicked Finish
    3.- Let Eclipse do the import.
    4.- Click Run on Server (I selected Tomcat 8)
    5.- Error appears:
    Estado HTTP 500 – Error instanciando clase de servlet com.caucho.quercus.servlet.QuercusServlet

    Any ideas?

    Where do I add the code “Maven WAR Overlay”?


  • Hi, as far I remember eclipse wasn’t exactly the easiest “tool” for deploy things, I try to give you some tips:

    – locate your tomcat installation
    – download http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.36/mysql-connector-java-5.1.36.jar
    – put the jar in “yourtomcat/lib/” folder
    – start tomcat: “yourtomcat/bin/startup.sh” (or .bat if you’re on windows)
    – rename the downloaded jwordpress war to “jwordpress.war”
    – copy the war in “yourtomcat/webapps”
    – in browser try “http://localhost:8080/jwordpress”

    Another way could be the MAVEN WAR OVERLAY (just an overview):
    – With the eclipse create something like a ~”empty maven project”
    – Replace the pom.xml file with the code posted here
    – Sync eclipse maven project and try to deploy from the eclipse project

  • Thanks, I’ll give it a try or two!

    I also have Netbeans installed.
    What tool did you use?

    • IntelliJ, but the community edition doesn’t have the plugins for easy deploying on various application server. Anyway I remember that Netbeans was a little simpler on that.
      The Maven approach requires some more ‘developing’ skills, but allow you to work on the same project with all major IDEs and have better interaction with the team. Moreover, looking at http://bonfab.io/tomcat-maven-plugin/ you can use maven itself to simply run a webapp.
      These procedures are quite standard for developers (sadly not yet for a designers) so you can find a lot of resources on google and stackoverflow.

  • Thanks, I also have IntelliJ Idea Community Edition,

    If I get stuck I can ask some developers, thanks!

  • Many thanks for putting this together. Questions:
    – Are you planning to upgrade to WP 4.3 soon?
    – Under Tomcat on Windows, I get these warnings:
    “com.caucho.quercus.lib.mail.MailModule.mail Quercus[] mail could not send mail to ””
    “Could not connect to SMTP host: localhost, port: 25”.
    Is there a configuration file that could be changed to instead point to Amazon SES (my target environment is AWS) with a secure login (TLS on port 587)?

    • You’re welcome!

      – WP 4.3: Yes, I’ll try it ASAP 😉
      – Mail: not tested yet, but I would check the official WP documentation… the only difference here is that WP thinks to be deployed on a standard PHP environment, so all the configurations file still apply

      • First, in WEB-INF/web.xml, the following setting has to be uncommented:


        Then in php.ini, SMTP settings expected by the Quercus MailModule can be specified.
        But then, php.ini is still not processed, unless it is specified with an absolute path, e.g. “C:/Tomcat/webapps/…/WEB-INF/php.ini”. So, there is a problem with accessing php.ini from a relative path.

  • With Quercus + WordPress on Tomcat, a bunch of plugins either do not work at all (jWordPress does not start correctly) or crash. For example, a plugin to import the WP export file requires a change in a function:
    Warning: c:\…\webapps\blog\wp-content\plugins\wordpress-importer\parsers.php:75: function ‘simplexml_import_dom’ called with 1 arguments, but only expects 0 arguments [simplexml_import_dom] at simplexml_import_dom com.caucho.quercus.UnimplementedException: `simplexml_import_dom’ has not been implemented. A more recent version of Quercus may be available at http://www.caucho.com/download Requests for unimplemented features can be entered in the bugtracking system at http://bugs.caucho.com

    This bug was reported 7 months ago but no resolution yet:
    Any idea on how to fix it? Importing a large number of WP posts by copy-and-paste is not practical.

    • Hi, thanks for testing it. I still not have too much confidence on the quercus code, and looking at the sources in svn, I didn’t find tags correspondence for the binary releases downloaded from the site.
      Given that I’m not sure if the current trunk will produce the quercus-4.0.44.war (unofficial released) I’m using, and not being a maven project either doesn’t help.

      So even in the worst case that’s my plan:
      – decompile the classes with not implemented functions
      – implement and recompile it
      – substitute the .class in the war

      Bad practice I know… but with an automated process could be still manageable.

      I hope that this little experiment helps to give some interest to quercus from the community (and Caucho above all)

  • Kaz Nishimura
    3 years ago

    Thank you for the useful information. WordPress 4.0 and 4.1 caused stack overflow so I haven’t tried 4.2 or later.

    By the way, do you know Pretty Permalink Filter? It’s my work and was written to make WordPress”s pretty permalinks work on Quercus. It’s on the Maven Central Repository and on Servlet 3.0 containers, it installs itself without any configuration. If you feel it is useful, please give me a feedback.

  • Kaz Nishimura
    3 years ago

    Thank you for using my product! If you find a problem or have a feature request, feel free to create a issue on Bitbucket.

    By the way, I am also trying to decompose Quercus into modular Maven projects from their Subversion repository with several modifications. It is available here: https://bitbucket.org/kazssym/quercus

    If you would like such a thing, please take a look and give me a feedback or two.

    • Wow, that’s amazing, I’ll sure have a try, how did you stay in sync with the svn upstream repo?

      • I used Mercurial’s hg convert command to convert the repository from Subversion and rename files as I’d like. I made several tries and errors before making the current shape. Since the hg convert command leaves conversion history, I can import new changes when necessary.

  • Roderick L. Barnes
    2 years ago

    This is one of the most outstanding engineering products to come out in a long time. Hats off to Caucho for giving us Resin and Quercus. But you are to be recognized for your contribution – a prebuilt combination of WordPress and Quercus!

    Please contact me at your convenience to discuss how we can promote your work with more than just applau$e.

  • iBenzung
    2 years ago

    It is very great integated framework and I have tried it for a while.

    I found that it have problem about “using non-english character to change theme content in some theme such as Enigma Theme”.

    For Example:
    I want to change slider title to Thai character encoded “บางสิ่งบางอย่าง” then save & publish, the page show “2)2D”.

    But for XAMPP server, it worked correctly.

Leave a Reply

Your email address will not be published. Required fields are marked *