Monday, November 1, 2004

Further Adventures with Roller Weblogger

This exercise pointed to the org.roller.presentation.RollerSession object, a Java SessionListener. Then I started playing around with the various ways in which this listener could be invoked and determined the core problem was that this listener was specified in the roller.tld tag library definition file.

The "Fix"

I have no idea what functionality I disabled by removing the reference to the org.roller.presentation.RollerSession listener in the roller.tld file, but that's what I ended up doing to get around this problem. Since I really didn't want to rebuild the entire rollerWeb.jar from source, I simply deleted the roller.tld file from the .jar using WinZip, then imported the roller.tld into a tlds folder under the Web project's WEB-INF folder.

This way, I could delete the reference to the listener, that you can see in Figure A, without having to disturb the other contents of the .jar.

FIGURE A

Delete these three lines in the roller.tld file to get things rolling. (click for larger image)

However, since I removed the tag library definition from the application's .jar file, I needed to set up a reference to the new location so that the application could locate it.

To create a resource reference to the new location of the roller.tld, I opened up the Web project's Deployment Descriptor, and using the tabs along the bottom, navigated to the References panel. Using the tabs across the top, I opened up the JSP tag libraries reference page in Figure B.

FIGURE B

Open up the JSP tag library reference screen to enter the reference to the relocated TLD. (click for larger image)

Clicking on the Add button brought up the "Add a tag library" dialog box in Figure C, where I selected the roller.tld file and clicked finish.

FIGURE C

Use this dialog to add the reference to the new location of roller.tld. (click for larger image)

Closing and saving the Deployment Descriptor completed the task.

After rebuilding the project, however, I still had errors, and found that I needed to do one more thing. I opened up the Deployment Descriptor one more time and clicked on the Source tab, located the new entry and changed the uri property to the original uri specified in all of the .jsp pages, like in Figure D.

FIGURE D

Insert the correct URI right in the source to correct the remaining errors. (click for larger image)

This time, the rebuild of the project did not result in any errors, so I felt that I was now ready to try things all over again.

3, 2, 1 . . .

Once again, I right-clicked on the Web project to bring up the context menu and selected Run on Server. Since I had checked the Always use this Server box during the initial run, it just went right to work bringing up the app server.

Once again I waited patiently(?) for that initial roller screen to pop up in the browser window, the way it did the first time I ran the Roller demo package on Tomcat. This time, my efforts were rewarded with the image depicted in Figure E.

FIGURE E

Success at last! (click for larger image)

Finally!

I still had no idea what features or functions I had broken by removing the listener reference from the roller.tld file, but at this point, I was ready to declare success and start thinking about deploying my new creation to an app server. First, I thought I better take a look at the Weblogs and make sure that's all working, so I clicked on the Admin's Weblog link in the right-hand column.