devNoo

musings of a Software Developer

JSF 1.2, facelets and webspere: Can’t get it to work

| 4 Comments

I finally got it to work see the next post.

Spent the last couple of days trying to get JSF 1.2 running on a websphere 6.1 installation with no luck so far.

We really need this because we have a lot of trouble with the default jsf bundled with websphere (JSF 1.1_02). Especially the datatable component in this release seems kind of buggy.

The problems of getting JSF 1.2 to work are the following:

  1. Websphere 6.1 comes with a bundled JSF in its classpath. And you can’t just remove that jar from the server as it is a custom jar with more than just JSF.
  2. Webspehere 6.1 is not a servlet 2.5 container, wich you would normally need for JSF 1.2.

For the first problem there seems to be a simple solution, or even 2.

The most simple one would be to deploy an application with al neccesary jars in it and change the classloader policy to application first. Alternatively you could create a shared_lib and then define a classloader in your server with the policy application first and with a reference to the shared library. This would be my preferred way of going about this, because you would only have changes on the server and can use it for more than 1 app. (BUT this can also be a problem if you don’t want other apps to get classes from this shared library).

The second problem seems to be more complicated. For JSF 1.2 you need the el that is a part of the jsf 2.1 spec. And that is a part of the servlet 2.5 spec. But we are not using jsp as our view technology but facelets instead. Facelets comes with its own el libraries on wich you should be able to get jsf 1.2 working.

Well that’s the theorie. When I installed facelets, jsf 1.2 (tried RI and Myfaces) with al the dependencies in a shared_lib, created the classloader and tried to start a simple jsf page it worked, but as soon as the page got less simple it didn’t seem to work anymore.

The problems where the following:

  1. Instable. Pages would load some times, and sometimes they wouldn’t. Only restarting that very fast webspere server (approx 2 minutes for a simple restart) would fix this problem. The errors where often pointing in the direction of the RestoreViewPhase. Other times it was about illegal argument exceptions on tomahawk tags.
  2. We used the a custom validator with an attribute on our page. The attribute at first didn’t seem to be bind, later on however I discovered that when I opened the page the attribute was bound, but when I submitted the page a new validator instance was created and the attribute was not bound to that.
  3. Components where also recreated without the binding of attributes, but on a component you can implement the methods to save and restore the state. This is imho odd behaviour but as it can be fixed we can learn to live with this.

Well , I’m afraid I have to conclude that I can’t get it to work. On the Internet there where some post in which people said they did it, but I never found a description on how they did it so that doesn’t help either.

If anyone knows a solution to this problem please let me know.

Leave a Reply

Required fields are marked *.