WARN 2008-09-28 13:55:17,116 org.hibernate.cfg.SettingsFactory -s Could not obtain connection metadata
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
MESSAGE: Connection refused
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
Basically, the problem here is because of jdbc connector, which was unable to connect to the database. There are two ways of communication with mysql in linux.
- Don't listen on a TCP/IP port at all, if all processes that need to connect to mysqld run on the same host. There interaction with mysqld are made via Unix sockets or named pipes which is .sock file.
- B. Simply listen on a TCP/IP port. This allows remote communication to the database too.
Lampp initial configuration sets the first method of communication. And the sock file is created in < lampp root dir >/var/mysql/mysql.sock . But by default the jdbc search it in "/var/run/mysql/mysql.sock" (somewhere like this). Due to this problem, jdbc wont be able to connect to the database.
There are many ways to solve this:
The simple one is to switch to second type of communication method.
find the following line in <lampp root dir >/etc/my.cnf
and comment it.
Hope this helps you out.