A Django site.
May 29, 2007
» Installing OpenMRS on Apple OS X

After considerable effort, I’ve finally got OpenMRS installed on OS X. Over the past day or so, a few installs on OS X have come up, and I’m happy to join those who have got an install working. My Powerbook, an Apple PPC laptop, now is successfully running MySQL, Tomcat, and the like in a satisfactory way such that OpenMRS will run.

Recently, the guide for developers setting up OpenMRS on OS X has surfaced as Step-by-Step Installation for Developers on OS X on the OpenMRS wiki. I tried to follow the page, as I had almost everything done already. I upgraded my version of Ant and of Tomcat, and even to the latest not-quite-supported version of Java from the Apple Developer Connection. It wouldn’t quite work, for some reason. My errors changed sometimes, but the error I couldn’t fix was that OpenMRS was deployed in Tomcat, but Tomcat couldn’t start the application for some reason.

The web interface gave no clue as to what the problem was (any clues to the answer would be hidden in a log file, of course). I searched through the log file catalina.out in Tomcat’s logs folder, and above a massive (I mean massive) stacktrace, I found this:

Attempted reconnect 3 times. Giving up.
Could not connect to database using url ‘jdbc:mysql://localhost:3306/openmrs?autoReconnect=true’, username ‘test’, and pw ‘****’. Connection properties can be set with runtime property: ‘connection.username’, ‘connection.password’, and ‘connection.url’

Fun. Apparently, there is a problem with MySQL. I can’t connect with username ‘test’ and password ‘test,’ the defaults, which should have been created by the sql scripts I ran earlier. However, MySQL is a silly little creature. The user exists; I made sure by looking at some columns from the mysql.user table. But I can’t log in. I can log in without a password..but why not with the password he is assigned? I note that the other users (root, etc) have hosts that are normal, and work with passwords. The host for ‘test’ is ‘%’. So I delete that user, and create a new user with host ‘localhost’. Miraculously, this works. OpenMRS is now installed in my mac:

OpenMRS on OS X

I added the solution to my problem to the OS X install wiki page, which seems even more reasonable seeing as I have since learned that Anders was having the same problem on his Macbook Pro. This is clearly not even limited to old macs, much less my own computer.

May 28, 2007
» Installing OpenMRS on Ubuntu Linux

Between last Thursday and this morning, I installed a working copy of OpenMRS (changeset 1825). Since I’m working as a developer rather than as an implementer, I followed those instructions (truth be told, I used a combination of the two instructions to figure out some of the problems).

The first step is the “pre-requisites,” namely the Java JDK, MySQL, Ant, Tomcat, Eclipse, and Subversion. I installed these via some terminal commands using ubuntu’s package manager (e.g., sudo aptitude install subversion). These all finished, so I moved on.

The second step is checking out a copy of the code from the alpha branch, and building that with ant. Checking out code was fine, but the command ant install gave me many problems. This was Thursday night, and I was working with in-development code, so I gave up for the moment, and hoped that over the weekend it would be fixed, and didn’t bother myself with it for a while, since I had a wedding to attend over the weekend. Back on Sunday night, I still could not get it to work with updated code. I assumed that it was a problem on my end, and deduced from the error and line of code in which it failed that I had a Tomcat problem.

My main problem was that tomcat was not running. Ubuntu 7.04 apparently has a bug in the tomcat init.d script that, for whatever reason, makes the service not fully start. There is no error, just a lack of starting. I fixed this, and confirmed that tomcat was starting and continued to stay started. However, it still would not work, and failed on the same line. I could not actually connect to the tomcat server via my browser either, so I gave up on the Ubuntu-packaged tomcat and followed instructions on installing tomcat 6 directly, including editing users and adding the following lines to /usr/share/tomcat6/conf/tomcat-users.xml:

<tomcat-users><role rolename=`manager`/>
<role rolename=”tomcat”/>
<role rolename=”admin”/>
<user username=”tomcat” password=”tomcat” roles=”admin,manager,tomcat”/>
<user username=”root” password=”my-root-password” roles=”admin,manager,tomcat”/>
<user username=”test” password=”test” roles=”admin,manager,tomcat”/>
</tomcat-users>

After struggling with users in tomcat like this, I finally was able to finish running ant install.

For step 3, the SQL databases, I did as such, after figuring out how to run the sql files. I’m really just glad I remembered my MySQL root password. In any case, I set up MySQL with not too much trouble. At least compared to my tomcat problems.

The biggest problems I encountered were just myself not knowing how to correctly install and configure Tomcat and MySQL on an Ubuntu system. A few small changes are needed to the Step-by-Step Installation for Developers page on the OpenMRS wiki, but nothing too drastic. After getting the pre-requisites actually fulfilled, a developers’ install of OpenMRS is quite easy.