WebSphere related
Monday, July 17, 2006
how to run roller 2.0.2 (blog system) on WebSphere
- You have Websphere 5.1 or above with latest fix packs and RDBMS.
- Download roller source from https://roller.dev.java.net/servlets/ProjectDocumentList you need source code and tools like hibernate.
- Download patch and look throw files you’d like or don’t like to add/change. web.xml, hibernate.cfg.xml and so on. Patch work with DB2, so you may want to change hibernate settings in order to use other database.
- Extract all files into one folder, when you extracting patch, it should overwrite some previous files.
- Set JAVA_HOME to WebSphere Java. Run build file. You will find additional task to build war for WebSphere.
- Create database, create table as in build Web-Inf/dbscripts, map datasource to jndi name jdbc/rollerdb and add mail session.
- Install war file throw admin console. Register with your credentials.
Roller Weblogger and WebSphere
Here is some tricks and hints about migrating Roller Weblogger to WebSphere. I hope it would help people run other sophisticated web applications on this platform.- First of all I fix web.xml - delete some tags related to Resin, comments, etc. and add references to resources (database, mail, taglibs). Generally, xdoclet generation is much better way to produce descriptors, but in my case where's a lot of things to be edited to get one file web.xml .
- Tag libraries. There's a lot of problem trying WebSphere to work with them. Foolproof method is to get all tld's in folder in WEB-INF , link location to them in web.xml and check uri in jsp files with web.xml . It's easy thing, but more strict than standart, so it often happened that some apps work on Tomcat and don't work on WebSphere.
- Logging and other properties. Log4j properties use file in Tomcat base. I put org.apache.log4j.ConsoleAppender instead.
- Internationalization. By default, Websphere use different code pages for locales. I run it with parameter -Dclient.encoding.override=UTF-8 for Generic JVM Arguments. It is a most radical way to force WebSphere use UTF-8 for all web apps. If ekit applet run without locale parameter it use client language to show menu from resource bundle.
- Hibernate. Besides providing jndi reference to database it's a good idea to additionally configure JTA and caching.
- Authorisation and authentification. Permit all that not forbidden in web.xml. Roller use own database for storing users and roles. In my case I have custom users registry, and suppose that only that users will have an access to blog. So, button register ask user to its custom login and password and put his own data into database. The primordial idea is to put blog editor functionality in portlets. In general case, of course it need to be changed.
Roller Weblogger 2.0.2 DB2 issue
There's something to do, to work Roller with DB2.- Since Roller work with Hibernate, change hibernate.cfg.xml to add org.hibernate.dialect.DB2Dialect to dialect property
- Create database in DB2 and make your app. server work with it
- Create tables and indices in database using dbscripts/db2/createdb.sql . Take note of two things :1. Command Center GUI don't like SQL-style comments -- 2.In generated script I find a small bug
create table(.. pubtime timestamp null)produce error SQL0104N An unexpected token "," was found following "timestamp null". pubtime . Delete null -it's by default. - When Roller looked for recent entry it generate a loooooong query. In case of in case of COM.ibm.db2.jdbc.DB2Exception:SQL1585N SQLSTATE=54048 create system temporary tablespace with page size 16K. Here is generated script on my computer
CONNECT TO ROLLER;
CREATE BUFFERPOOL ROLLERBUFFER IMMEDIATE SIZE 250 PAGESIZE 16 K ;
CREATE SYSTEM TEMPORARY TABLESPACE ROLLERTEMPSPACE PAGESIZE 16 K MANAGED BY SYSTEM USING ('C:\DB2\rollercontainer' ) EXTENTSIZE 8 OVERHEAD 12.67 PREFETCHSIZE 8 TRANSFERRATE 0.18 BUFFERPOOL ROLLERBUFFER ;
ALTER TABLESPACE ROLLERTEMPSPACE PREFETCHSIZE AUTOMATIC SWITCH ONLINE ;
CONNECT RESET; - In class HibernateRefererManagerImpl method getDaysPopularWebsites have wrong special handler with DB2 raw sql. GROUP BY expression in this case must have all selected items(sqlcode : -119 sqlstate : 42803). Also one item (w.name) selected twice making a wrong link to blog in presentation. Correct code :
"select u.username,w.name,w.handle,sum(r.dayhits) as s
from rolleruser as u, website as w, referer as r
where r.websiteid=w.id and w.userid=u.id and w.isenabled=?
group by u.username,w.name,w.handle,w.id order by s desc fetch first" +
Integer.toString(max) + "rows only");
Wednesday, July 12, 2006
Roller Weblogger and WebSphere.
I've looked through my labor contract recently and found an item on installation weblog system.I goggled for some blog web application and only one was fit to me - Roller Weblogger . The main idea is to find a solution that integrated with other application infrastructure. Unfortunately, this product mostly build on Tomcat+MySQL. The well known profit of Java application is platform independence. In my case, migration apps is not an easy thing. I solved this problem somehow, in next posts I describe it.
Application platform - WebSphere 5.1 (also checked on 6) with JDK 1.4+ and latest fixpacks. Database - DB2, but I think any RDBMS, supported by Hibernate and Roller will work well. In all case where it possible I use UTF-8 encoding. Some problems appears with Acegi Security, it's hard to integrate Acegi with custom WebSphere security, maybe lately I find a time to do it. That's why I decide to take Roller 2.0.2 build since it's the last one that use web.xml based security.
After a few time I find articles dedicated to my problem by Jeff Chilton.
I was really delighted and inspired by this articles, they helped me in some cases.
