First RichFaces application on Netbeans 6

As part of almost sadomasochistic effort vocational software developer have, I'm doing a brief introduction to developing with RichFaces, from new IDE installation until minimal working application. The aim is not doing a tutorial, neither howto nor step by step (if you're reading this I suppose you don't want anybody to tell you to press 'next').

I've recently installed Red Hat Developer Studio beta 1, but I think it's still interesting using Richfaces on other IDEs so you don't have to switch between environments.

1.- Download last version of NetBeans 6 M10.
2.- Download last builds of RichFaces and Ajax4JSF, including sources (it contains javadoc and allows you to debug). They're merging soon in one only project.

**I'm using unstable versions because I'm at home, don't tell your boss to do this if you don't want to be fired ;).

3.- During the 180MB download you'd take a look at Richfaces and Ajax4JSF developer guides.

4.- Launch installer. Just some notes during the installation:

  • Tell installer to configure Tomcat 6.
  • Change default passwords and ports and write them down.
5.- Open Netbeans and create a new Web project running on recently installed SJSAS 9. Activate JSF.
6.- Press F6 for running the server, deploying and opening a browser. It should show 'JavaServer Faces' inside an html H1 element.

7.- Untar RichFaces, which contains both Ajax4JSF and RichFaces.
8.- Create a new library with those jars and add it to the project: project properties --> libraries --> add --> manage --> new library. Add both binary jars and sources.
9.- Apply the needed changes for a Richfaces application: add web.xml configuration and richfaces taglib.
10.- Restart application server. During the boot you could say hello at Richfaces users forum. You're going to use it very much, and Richfaces developers have been infinitely patient with me :). I had never seen such a good support in an OpenSource project.

11.- Ooops, first error! NoClassDefFound because of absence of Commons Logging, del que depende. You must add the following libraries:
  • commons-logging (bundled with Netbeansincluída con NetBeans)
  • commons-digester (download)
  • commons-collections (download)
  • commons-beanutils (download)
12.- Restart the server and ¡voila!

Nothing spectacular, but it'a a beginning.

Red Hat Developer Studio first contact

I've been working on a relative small project for some months ago (more than a year). Since I began it on the Old Days it was done with Struts + Hibernate. Since then J2EE community has evolved very much, and there are some technologies that make my old fashioned design look old. More specifically, I want Ajax for my users.

I wanted to migrate it to a JSF + RichFaces + Seam + Hibernate arquitecture, but I wanted to wait until Red Hat Developer Studio was released, since it supports every technology I want to use. That day is finally here, and you can download Red Hat Developer Studio Beta 1. In this post I'll tell you about its installation and my first minutes with it (real time). This is neither a deep review of RHDS (can't be, yet) nor a study on Seam (same) or a J2EE for dummies guide. Hope somebody finds is interesting.

FYI, this is a 2GB Centrino laptop running Gentoo.

STARTUP
1.- Download Red Hat Developer Studio Beta 1 for Linux: ~530MB! It's huge!
2.- Launch installation: java -jar rhdevstudio-linux-gtk-1.0.0.beta1.jar.
3.- Follow instructions. 3 minutes long, no important notes. It creates a beautiful red icon in my desktop :).
4.- Clicking the beautiful icon leads to an instant beautiful crash (one of those eclipse crash dialog) on my system (java 1.5.0_12 by default). I don't know why, but specifying java path manually solves the problem: ./eclipse -vm /opt/sun-jdk-1.5.0.12/bin/java.
5.- It begins with a migration (from JBoss Studio) wizard I can't take advantage of, so it gets closed after doing nothing. I suppose JBoss Studio users will appreciate it.

FIRST IMPRESSIONS
It looks exactly like you'd expect Eclipse look like after installing a bunch of plugins. RHDS perspective gives me a first joy: a RichFaces palette (no calendar yet, I'll have to wait). A quick look at "Manage Configuration" reveals it includes, among others, these plugins:

  • Dali (JPA).
  • EMF (Modeling).
  • JST (checked as it had problems, hope this doesn't turns severe).
  • WST.
  • Hibernate Tools.
  • JBoss stuff.
  • Shale tools.
  • Spring.
There are also some new (at least for me) perspectives probably interesting: jBPM PDL and JBoss AS. I'll go deeper on them other day.

FIRST PROJECT
My aim is starting a RichFaces + Seam + Hibernate (JPA) project from scratch. Theoretically this is the best IDE for this. Let's see if it succedes. From RHDS perspective:
1.- File --> New --> Seam Web Project.
2.- Add Java Persistence facet to the project.
3.- Create a database connection profile (mine's MySQL 5.0).

After a little browsing through views it gets slower and crashes ("double free or corruption"). I'll increase memory (eclipse.ini) and restart. Later it gets obvious that it's "Red Hat HTML Editor" (JSPs default one) which causes the problem. It's maybe related to a known issue at the FAQ. Nothing urgent, anyway.
Update: this problem has automagically vanished. I can use RHHE ok now, dunno why...

Project has a nice 'All JBoss Libraries' library which contains 50+ jars which will hopefully let me develop without worrying on jars (for a while at least). Something similar happens with 'Web App Libraries', which includes not only seam but also other must-have like facelets.

It has an error (red square). You can find the error at 'Problems' view: "no persistence.xml" file in project. That's wrong, since it's at src/META-INF. Well, let's deploy! Shift+Alt+X, R will run it on a server. Since it's not configured yet it asks me which. I choose bundled JBoss 4.2 and cross my fingers. Starting... crash! :-\ Sigh... Well... Something wrong with the database: "Apparently wrong driver class specified for URL: class: com.mysql.jdbc.Driver". It seems something doesn't like my mysql connector.

It finally got solved copying mysql connector at jboss-as/server/default/lib. First JBoss lesson learned. After that, the welcome page was accessible.

RH HTML Editor issue aside, RHDS seems promising. Is finally the time Java development meets Visual Whatever integration? Hope so...

Ave, Good Programmer!

Some days ago I was in a room with some developers. I was grumbling, as usual, on something (I can't remember what). As usual, my idea of throwing my salary away and building an enterprise came out again. Some of them thought I was joking, but I said my intention was hiring only the best developers available and paying them double salary of what they can find at the city. I, as I've said before (in Spanish yet), believe the difference between the best and the others is spectacular. I've just read another worthless post: 10 Developers for the Price of one.
If I just could get four of five of them, paying double salary (or even more!), there would be margin to make big money, at the same time they get a great payslip and a gratifying job...

Dreaming's free, I suppose...