WANT TO CONVERT A PHYSICAL MACHINE TO VIRTUAL MACHINE

I basically do not have any problem to reinstall vm with latest centos, but a java based application with mysql database is running on that VM and I do not want to loose the environment in which the application running, I thing if I upgrade the o.s the programme will run but I do not have any idea to recreate the programme environment on ne o.s, if you can suggest regarding this.
 
on that centos 6.4 mysql was installed but in the converted vm mysql service is started but it could not fetch data from database, can u tell how to resolve that.