We present the results of our investigation, using a Chandra X-ray observation, into the stellar population of the massive star formation region G5.89-0.39, and its potential connection to the coincident TeV gamma-ray source HESSJ1800-240B. G5.89-0.39 comprises two separate HII regions G5.89-0.39A and G5.89-0.39B (an ultra-compact HII region). We identified 159 individual X-ray point sources in our observation using the source detection algorithm texttt{wavdetect}. 35 X-ray sources are associated with the HII complex G5.89-0.39. The 35 X-ray sources represent an average unabsorbed luminosity (0.3-10,keV) of $sim10^{30.5}$,erg/s, typical of B7-B5 type stars. The potential ionising source of G5.89-0.39B known as Feldts star is possibly identified in our observation with an unabsorbed X-ray luminosity suggestive of a B7-B5 star. The stacked energy spectra of these sources is well-fitted with a single thermal plasma APEC model with kT$sim$5,keV, and column density N$_{rm H}=2.6times10^{22}$,cm$^{-2}$ (A$_{rm V}sim 10$). The residual (source-subtracted) X-ray emission towards G5.89-0.39A and B is about 30% and 25% larger than their respective stacked source luminosities. Assuming this residual emission is from unresolved stellar sources, the total B-type-equivalent stellar content in G5.89-0.39A and B would be 75 stars, consistent with an earlier estimate of the total stellar mass of hot stars in G5.89-0.39. We have also looked at the variability of the 35 X-ray sources in G5.89-0.39. Ten of these sources are flagged as being variable. Further studies are needed to determine the exact causes of the variability, however the variability could point towards pre-main sequence stars. Such a stellar population could provide sufficient kinetic energy to account for a part of the GeV to TeV gamma-ray emission in the source HESSJ1800-240B.