Migrating to newer versions of Jboss – the pains..

It is ironic how fast technology changes and programs written in older software become obsolete and have to be migrated to the newer technologies with some effort, sometimes due to a loss of backward compatibility. This applies to the tutorials written on this blog as well. One point for example was the JDOM parser example that I had to rewrite for the new JDOM API http://cuppajavamattiz.com/2009/03/19/using-jdom-to-map-an-xml-to-a-pojo-bean/ JBoss is one software that adapts to the latest J2EE technologies faster than any of the other existing J2EE application servers, as soon as a new J2EE spec is released. This sometimes causes a lot of heartache when you find that a program written for an earlier version of JBoss no longer works on the newer one.
I tried to run the pagination example at http://cuppajavamattiz.com/2007/05/21/web-design-patterns-at-work-with-pagination/, but found that I was running into problems either at JBoss startup or at runtime. Let me describe some of the pains I had to take.
I downloaded the latest version of JBoss(jboss-5.0.1.GA-jdk6.zip) and tried to run the pagination example described in the link above with the same source code and jar deployments.
The first problem I had was a Jboss startup error:
ConfigurationException: CONFIGURATION FAILED! ..class..cannot be cast to..class..
Thinking this was a version problem with the JSF jars that I was using, I experimented with various versions of the jar files, until I found the problem: JBoss has its own set of JSF jars under jboss-5.0.1.GA\server\default\deploy\jbossweb.sar\jsf-libs in its new avatar and the jars in my war/lib were clashing with those already on the JBoss server.
So I replaced my older JSF jars in the WAR with those in the Jboss installation.
The older verions of the tlds too were not compatible with JBoss, as I got the following exception:
Failed to load or instantiate TagExtraInfo class: com.sun.faces.taglib.FacesTagExtraInfo
Next I found that JBoss could not locate JSF tlds under WEB-INF. It apparently did not look for the relevant tlds inside the JSF jar files:
Could not locate tld files under WEB-INF.
I found that the tld files under WEB-INF of my war file had to be replaced by the tld files in the META-INF folder of the jboss JSF jars. This done, the problem too vanished.
I packaged the the MySQL driver that I was using within the lib folder of my WAR file only to get:
Apparently wrong driver class specified for URL: class: com.mysql.jdbc.Driver
The problem was that I had forgotten that JBoss looks for the database drivers under jboss-5.0.1.GA\server\default\lib and not in the WAR file.
This done, the application successfully executed without a hitch.
Just for documentation, here is the version of mysql-ds.xml that I used.(to be put in the deploy folder of jboss)

<?xml version="1.0" encoding="UTF-8"?>

About cuppajavamattiz
Matty Jacob - Avid technical blogger with interests in J2EE, Web Application Servers, Web frameworks, Open source libraries, Relational Databases, Web Services, Source control repositories, ETL, IDE Tools and related technologies.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: