Archive for April 2008

log4j:WARN No appenders could be found for logger

baby by side

I had written a simple core-java program to test the log4j functionality. I decided to test RollingFileAppender and console appender with that. Everything goes fine, till I run the file. When I run the file I count see the log; instead I have seen a warning like

log4j:WARN No appenders could be found for logger

when I added BasicConfigurator.configure(); I have seen console appender is working fine. But I need to add PropertyConfigurator.configure("log4j.properties") to get the log in the rolling file.

BasicConfigurator is used to do the quick configuration so that the log can be displayed in the screen.

PropertyConfigurator of log4j instructs PropertyConfigurator to parse a configuration file and set up logging accordingly.

You can see a get started guide to log4j in the loose-sheets

Integrating tomcat 6.0 and Eclipse europa

Till now I was using eclipse and tomcat separately, I was not that much serious about deployment, generally I goto the web application folder and edit/compile there itself. I know tomcat can be integrated with Eclipse, but I never tried. Today I have no other go. I need to do it. Here are the steps.

Register Tomcat with Eclipse

Select Window>Preferences

select the server you want to add, here we are adding tomcat 6.0 available under apache node

fill the necessary details

Here you can see the server is added to the list

You can see a new Project called Servers added to the Project explorer, If it is already there, the server might have been appended to the list

now open the corresponding web project to be deployed and start running it (ctrl + F11). Select Run on Server option

specify the server in which the application is to be deployed.

Move the projects to be deployed to the server. Here we have only one.

Thats it. done! see the web page is getting loaded!

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

kuttikaranam

Today I had a new install of Mandriva 2008 linux. I wrote a java code to test the mysql connectivity. It ended with the following exception.

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Last packet sent to the server was 0 ms ago.

Alas, deeper google search gives me a solution that told about the mysql connectivity parameter in /etc/my.cnf

skip-networking

This parameter has been added for some security related reasons. Really I dont know what it is. I just removed that line, which solved this issue.

Another interesting Eclipse plugin – UML (reverse engineering)

happy boy 

I was searching for an eclipse plugin to reverse engineer the code developed by salto-db-generator for hibernate.  I found slime eclipse plugin, that automatically support many features like use-case diagrams, class diagrams etc.

This can be downloaded from http://www.mvmsoft.de/content/plugins/slime/index.htm

 A getting started page is found at http://www.mvmsoft.de/content/plugins/slime/help/gettingstarted/installation.htm

Please find attached a class diagram generated by the plugin

Attachment:
automated UML diagram

An eclipse plugin to automate Hibernate development

happy - baby

Yesterday I was digging a new pit, about Hibernate. It was very interesting to create the mapping xml files. But when number of table increases, when the table has many number of fields, it is highly error prone, time consuming. I was searching for an eclipse plugin to automate this, and found one.

http://salto-db.sourceforge.net/salto-db-generator/

Salto-db Generator is a faster and efficient plugin. They have a demo at their site as a SWF movie. That itself says about their quality of plugin.

Good work guys!