EZ rollin HSQLDB
I'm messing around with HSQLDB because I need to create an easy-to-install demo-only version of Roller. I want to bundle everything needed to run Roller and make it drop-dead simple to try Roller on your own machine. All that you, the potential Roller user, will have to do is to unzip the distribution file and run a startup script.
To make this work I need Roller, a database, and a Web app server, all bundled together into one downloadable file. That is easy to do: I start with a Tomcat distribution and drop Roller into the webapps directory. When Tomcat starts, Roller will start. Roller won't function without a database, so I need to add the tiny pure-Java HSQLDB database to the mix. I need to get HSQLDB started before Roller starts. This part is not so easy: after looking at the HSQLDB docs I found that I have at least three options:
- Use the "in-memory" version of HSQLDB. With this approach, no HSQLDB starter is necessary. If you use a JDBC connect string of the form jdbc:hsqldb:filepath instead of the normal jdbc:hsqldb:hsql://host:port form, then HSQLDB will start itself inside your process (is that cool - or what!). The problem with this approach is that it requires the person who installs my demo to edit a file - they have to set the path to the HSQLDB, or I have to rely on an unreliable relative path. Another problem is that, in this mode, HSQLDB will not accept JDBC connections from other clients - such as the HSQLDB database manager.
- Add a ServletContextListener to Roller that starts the "standalone" server version of HSQLDB on it's own thread when my Web app starts, on contextInitialized(), and shuts down when my Web app stops, on contextDestroyed(). There are a couple of problems with this approach. First, I don't want to add anything to Roller. Second, I want the database to be available for other Web apps - like JSPWiki which I will include in the demo - to do authentication. Finally, after some experimentation I could not get HSQLDB starting ServletContextListener to start before the other parts of Roller that need a database connection.
- Add a LifecycleListener to the Tomcat server.xml to start the "standalone" server verion of HSQL on it's own thread when Tomcat starts. To enable this, I also add some -D startup parameters to catalina.sh to tell my listener where the database file is and what port to use.
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
import org.roller.util.HSQLDBUtility;
public class TomcatHSQLDBPlugin implements LifecycleListener {
public void lifecycleEvent(LifecycleEvent event) {
if (event.getType().equals(Lifecycle.START_EVENT)) {
HSQLDBUtility.start();
}
else if (event.getType().equals(Lifecycle.STOP_EVENT)) {
HSQLDBUtility.stop();
}
else {
System.out.println(getClass().getName()+": Not handling LifecycleEvent: "+event.getType());
}
}
}
To plug-in to the Tomcat startup and shutdown process, I had to do two things. First, I placed a jar with my TomcatHSQLDBPlugin and HSQLDBUtility classes in a jar in tomcat/server/lib. Second, I added the following XML to the tomcat/conf/server.xml file along side the listeners already in the file:
<Listener className="org.roller.tomcat.TomcatHSQLDBPlugin" debug="0"/>
That's that. I've got this stuff working now. Next up: JSPWiki integration and then I'll make Roller-Demo available for download on SourceForge.
JavaOne!
I'll be at JavaOne this year, my first time ever. I haven't been to a real conference or to San Franciso in a couple of years, so I am pretty excited about the whole deal. I'm looking forward to meeting the Java bloggers, too. For example, I've never met Matt Raible or Russell Beattie or Simon Brown, or any of the other Java bloggers and I hope to change that next week. I also hope to hook up with some of the Sun Bloggers to talk about Roller at Sun. Along those lines: Atlassian is organizing a meetup that looks to be interesting.
Eclipse 3.0 on Mac OS X
I noticed that MyEclipse now supports Eclipse 3.0 RC1, so I downloaded both last night. I must say, I'm impressed. Eclipse looks and feels much better than before on the Mac. Font sizes are reasonable and the theme looks better in some way, but I can't quite put my finger on exactly what it is. Code folding is sweet!
Embedding HSQLDB in Tomcat.
I found an interesting article on Embedding HSQLDB in Eclipse, but what I really want to do is to embed HSQLDB in Tomcat. Is there an easy way to add a "lifecycle" plugin to Tomcat so that HSQLDB is started by Tomcat startup and shutdown by Tomcat shutdown .
IE team locked in a dark dungeon.
Joel Spolsky Microsoft took over the browser market fair and square by making a better product, but they were so afraid that Web-based applications would eliminate the need for Windows that they locked the IE team in a dark dungeon and they haven't allowed improvements to IE for several years now.
Why I care so much about bloggers.
Janne Jalkanen This is the reason why I care so much about bloggers: blogging gives You and Your voice (and I mean YOU, my dear reader) a possibility to be heard in a far more better and efficient manner than ever before in human history.
JRoller not out of the fire yet.
Monday morning traffic has proven that the JRoller performance troubles are not quite over yet. That slow query I mentioned earlier was not the only problem with Roller 0.9.9. We have been experiencing heavy load and have had to restart multiple times.
Update: we're working with Kirk Pepperdine of JavaPerformanceTuning.com to zero in on what looks like a very bad memory leak.
Roller and JRoller iñtërnâtiônàlizætiøn
Tonight I was finally able to get UTF-8 support going with Roller and MySQL. It was relatively easy for me to do this because of the hard work of new Roller team member Jaap van der Molen. Thanks Jaap! Also, working with a local copy of the JRoller database, I figured out how to convert the database to UTF-8. I used mysqldump to dump the database to a text file, edited the table definitions, and then "sourced" it back into the database. I'm not sure that this is the best approach, but it works. Here is a screenshot to prove it:
<img src="http://www.rollerweblogger.org/resources/roller/jroller-i18n.png" title="JRoller screenshot showing I18N" />
Triangle Software Symposium, day #2
Day number two went very well and all of the talks were excellent. I started with David Thomas' Mock Objects talk and Ben Galbraith's SWT talk. After lunch I went to David Geary's advanced JSF talk and ended up the day with Ben Galbraith again with his How to make Swing Sing talk. All of the speakers did an excellent job, covered lots of material, and had very different presentation styles. For example, Galbraith spent most of his talks sitting down in front on an IDE coding up examples and demos on the fly. Geary is a great speaker, but he seems to have a fear of demos. I have seen him speak three times now and every time he has a slightly different reason for not running his live demos. The Javalobby party was nice, with kabobs and baklava and beer and good company. I got to talk to Erik Hatcher for a couple of minutes about Roller's search engine problems and I will attend his Lucene in Action talk today for more insight into this issue.
Triangle Software Symposium
I'm attending the Triangle Software Symposium this weekend. So far it has been great. I went to David Geary's talk on JSF, Stuart Halloway's talk on Meta-programming and Bruce Tate's talk on Spring. Geary's talk was excellent, but I probably should have atteneded a different talk because it was essentially the same talk he gave to the Tri-JUG a couple of months ago. Halloway's talk was thought provoking and fun. Tate's presentation was good, but the subject matter was less than impressive. He told us that we would be blown away, but at the end, a show of hands proved that few people were even intrigued by Spring.
Today I'm going to focus on UI, as I have been doing in my day job. I'm going to attend David Geary's advanced JSF talk and Ben Galbraith's talks on SWT/JFace and "How to make Swing sing."
What a week.
I believe that we have finally stabilized JRoller. In case you didn't know, JRoller has been "on the fritz" for the two weeks since I deployed the latest version of Roller (0.9.9 -> 1.0) there. The root problem appears to have been a horrible query that would examine and sort 1.8 million rows and drag down MySQL for over 5 minutes. The query would only occur on one weblog and the use case that caused the query would not cause the query on other weblogs. I stress tested Roller on my homebox before deploying to JRoller, as I always do, but I don't have the test setup to simulate the JRoller load and I certainly would not have found this bug because it affects only one weblog and in only one use case.
Personally speaking, the bug caused me a lot of stress. My three children now hate me and think I am a barking monster, my wife is worried that I am going to snap, and I can't shake the desire to constantly check JRoller to see if it is up. It makes me wonder why I on earth ever volunteered to keep JRoller running after Anthony Eden walked away. Support from the Javalobby, Rick Ross and Matthew Schmidt, are what kept me going through this little nightmare.
On the positive side of things, the bug cause me to take a good hard look at the Roller queries and caching once again. I made a hell of a lot of fixes, optimizations, and improvements. Roller is probably running better than it ever has before and is putting only a tiny load on the Javalobby server. We still have some queries that run too slow, and I have some bugs to fix, but I think we are out of the fire (fingers crossed).
Fix-for Roller 1.0
Roller's JIRA issue tracker is somewhat broken at the moment, so we are tracking issues to Fix-For Roller 1.0 on the Roller Wiki. This list is mainly for the use of the Roller developers. Please continue to report Roller bugs to Roller's JIRA issue tracker and Roller developers will promote as many of the the worthy ones to the Fix-For list as time permits.
« Previous page of month (Jun 2004) | Main | Next page of month (Jun 2004) »