This post originated from an RSS feed registered with Java Buzz
by Simon Brown.
Original Post: Deploying Pebble on Resin 2.1.x
Feed Title: Simon Brown's weblog
Feed URL: http://www.simongbrown.com/blog/feed.xml?flavor=rss20&category=java
Feed Description: My thoughts on Java, software development and technology.
I've had a few questions about deploying Pebble on Resin over the past couple of weeks so I thought that I would write a short blog entry describing the process. I've tested this on Mac OS X (Panther), J2SE 1.4.1, Resin 2.1.11 and the latest development version of Pebble. However, I'm sure that these instructions will work for slightly earlier versions.
Grab Resin from here and extract to a directory of your choice.
Grab Pebble from here and extract to a directory of your choice. As with Tomcat, you can either extract it underneath the $RESIN_HOME/webapps directory, or anywhere on your disk.
Assuming that you've extracted Pebble somewhere other than the webapps directory, open up the $RESIN_HOME/conf/resin.conf file and insert the following XML before the closing host tag, changing the id and app-dir attributes as necessary. In addition to this, you can set up the users that you need for your blog. In the example below I have a single user that is both a blog-owner and blog-contributor.
For backwards compatibility and ease of development, Resin ships with a default invoker for all requests starting /servlet. As the comments say, this is is a major security hole and it should be disabled. In fact, Pebble won't work with this enabled. Simply find the block (shown below) in the $RESIN_HOME/conf/resin.conf file and remove it/comment it out.
<!--
- The "invoker" servlet invokes servlet classes from the URL.
- /examples/basic/servlet/HelloServlet will start the HelloServlet
- class. In general, the invoker should only be used
- for development, not on a deployment server, because it might
- leave open security holes.
-->
<servlet-mapping url-pattern='/servlet/*' servlet-name='invoker'/>
While everything seems to work, there does seem to be a small issue with the formatting of dates - sometimes the blog timestamps show the incorrect time. I've seen this myself where a blog entry posted on one day will be reported to have been posted the previous day. The underlying dates and permalinks work okay, it's just the JSTL formatting that doesn't. I think I've fixed this, by modifying the line that sets the timezone of the view components (JSPs) in the header.jspf file as follows.
I still don't understand why the formatting doesn't work in Resin, but this seems to do the trick for me, while still working on other containers such as Tomcat.
I'll put this in the Pebble user guide, but I hope it's useful to somebody in the short term. Oh, and thanks to Matt Read for some info on the Resin config.