from the Glassfish server log am getting an error below
WARNING: RAR8054: Exception while creating an unpooled [test] connection for pool [ hrms/connectionPo
Check that the jar containing the jdbc driver is library folder of your server
Is the MySQL daemon up and running? Can you connect to the server using the command line client? If not, start the server and re-run your application again.
I would advise you to separate your database code from user interface stuff. You'll regret combining the two the way you have someday.