Thursday, June 19, 2008

My First HORRIBLE JSF tutorial with NetBeans 6.1

I thought since I have been trained in some JSP and servlets and there's so much hype and buzz about JEE 5 , Glassfish server... JSF ... why not try them out and so, I use my 'trusty' NetBeans 6.1 . I use Netbeans because I was introduced to Netbeans during my courses and that Netbeans is Sun supported so ... what better to use than something that is endorsed and supported by Sun (maker of Java).

I browsed the Netbeans website and found a simple HelloWeb web apps tutorial for the JSF. The link to the tutorial is .

I setup my web apps according to what is said and set my server to Glassfish V2 since I wanted to try out Glassfish for the first time (I have to manually point Netbeans to the Glasshfish folder since Tomcat is set as default server) and I selected JEE 5 since I have not used JEE 5 but J2EE 1.4 during my courses.

First half of the HelloWeb went fine and I managed to create the specified app where you keep in your name and it echoes back.

The second half needs a Java DB/ Apache Derby database installed together with NetBeans package using the PERSON table in the TRAVEL database.

I managed most parts until when I hit the portion where the database is needed. I tried to connect to the TRAVEL database to view the database tables as they specified. I right click > Connect ... and guess what ?

ERROR ! Unable to Connect ! Cannot establish a connection to .... using org.apache.derby.jdbc.ClientDriver (DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ040, SQLERRMC: Failed to start database 'travel', see the next exception for details.::SQLSTATE: XSLANDatabase at C:\...\.netbeans-derby\travel has an incompatible format with the current version of the software. The database was created by or upgraded by version 10.2.).

I thought... oh no ... of all moments.. why now. I have been able to connect to databases using NetBeans 6.1 and I can even connect to my favourite database systems , the H2 database.

I thought to myself.. fine... why don't I look into other databases for use in this tutorial and of all things none of them worked !!!

I thought maybe since I can use H2 and I am getting more familiar with H2, why not use it to create a mock up TRAVEL database with just one table... called PERSON since that's the only table to be used and in the PERSON table, make a PERSONID and NAME field rather than the rest of the fields since the fields needed for this tutorial is simply the NAME field. I made it, got NetBeans to connect (I need to specify the schema manually too) , and I am done . I created and populated the database before getting NetBeans to connect just in case anything breaks. I can view the data I populated it with but when linking the PERSON table to the drop down list in the part 2, it didn't automatically or even show the names of users in the visual web editor as was said in the tutorial and when I tried to bind the drop down list to the database , there wasn't any values of the fields for me to select which field to bind.

I tried to create a Java DB / Derby database by using the database tools in NetBeans ... all those right click , create connection ..tables... the list of databases did not show the database I made at all !


As like many NetBeans tutorials I have attempted... it's always vague and leaving you to guess things.

I gave up on this JSF tutorial and just blog what happened here.

Firstly, why in the world is there such compatibility issues with Derby ? From the start, I don't like Derby because it just doesn't just run right off the box and you need to tweak things here and there.. use consoles... no out of the box GUI console to set up for you like what H2 and MySQL provide. Now, Derby just drop lower in my eyes after this incident. Why of all things is there a compatibility issue I have to handle and not handled by the system ? H2 and MySQL , for what I know by using them , didn't give me such stupid compatibility issues.

And one thing... why would the drop down list not recognize my H2 database's TRAVEL database ? The errors aren't even H2 database but most point towards some internal error and things inside screwing up ! Why would a database created using NetBeans provided tools not be displayed in the side bar after I tried to create a Derby database to use in the tutorial ?

NetBeans and Derby developers, if you are reading this, do look into the matters.

Just a word for Derby developers... if you want to truely make your database better ... make it feel 'warm and friendly' like what H2 did. At least have some GUI so people wouldn't be lost especially during setup.

No comments: