A frequent problem when it comes to internationalisation is proper handling of different charset. When you're using Java and Maven it is relatively easy to set up source encoding to UTF-8, but the frequent point of failure is in the SQL database.
If you use mySQL, and you have latin1 tables, but you should have UTF-8 instead, use this little script to convert from latin1 to UTF-8 :
mysqldump --user=${USER} --password=${PASS} --default-character-set=latin1 --skip-set-charset ${DATABASE} > dump.sql;
sed -r ‘s/latin1/utf8/g’ dump.sql > dump_utf.sql
mysql --user=${USER} --password=${PASS} --execute=”DROP DATABASE ${DATABASE}; CREATE DATABASE ${DATABASE} CHARACTER SET utf8 COLLATE utf8_general_ci;”
mysql --user=${USER} --password=${PASS} --default-character-set=utf8 dbname < dump_utf.sql
Generally speaking, don't hesitate to always put the --default-character-set=utf8 on all the mySQL commands you execute. Don't forget to add at the end of your jdbc connection url the following parameters : "useUnicode=true&characterEncoding=UTF-8" to ensure you connect using UTF-8.

JRebel ?

I use JRebel to speed up my development. It is a really impressive tool allowing to develop full blended Java EE application as you would develop in PHP. No redeploy, at the cost of a little slow-down in development mode. The tool does what it says, and it's worth the price ! The JRebel plugin for maven does the job very well by generating the rebel.xml file that does the magic.

What's the deal ?

Although JRebel is an awesome tool, there is some magic within, and, in special corner cases it might not work as expected. In my case I have a quite typical web application split in multiple parts:

  • a web application (war)
  • an ejb module (jar)
  • other modules not involved in my problem
The web application includes, in its WEB-INF/lib folder, the ejb-client artifact of my ejb module. To make it clear, ejb-client artifact is typically the jar containing the interfaces to be used by the client module(s).

The problem I had was that JRebel magic was reloading too much things : in fact, it reloaded classes even if they were not in the ejb-client. My application container (Glassfish 3.x) was not very keen on this thing. I opened a thread on ZeroTurnAround's forum and the answer I got is that I have to find a way to ignore files in my ejb-client module. By digging in maven-ejb-plugin, I didn't find anything to rename a file in the ejb-client module, and I didn't find a parameter to pass to JRebel to specify which filenames can contain its configuration.

Classic tailing

In my day to day activities, there is one thing I do everytime and I think every developer does : I tail the logs. The problem with logs checking is that you are rapidly facing a huge file, and the classic tail -f is not enough. The sad part of log tailing is that you only have monochrome logs, without any colouring of any kind helping you identify critical lines against more common ones.