def StartKvmSession(self, serviceProfile=None, blade=None, rackUnit=None, frameTitle=None, dumpXml=None):
		"""
		Starts KVM session.
		
		launches the KVM session for the specific service profile, blade or rackUnit.
		- serviceProfile specifies an object of type lsServer. Launches KVM session with which the service profile is associated. 
		- blade specifies an object of type computeBlade. Launches KVM session of blade server.
		- rackUnit specifies an object of type computeRackUnit. Launches KVM session of rack Unit.
		- frameTitle specifies the title of the frame window.
		"""
		from UcsBase import WriteUcsWarning, _GenericMO, UcsUtils, UcsValidationException, UcsException
		from Mos import MgmtIf
		import os, subprocess, urllib

		if (self._transactionInProgress):
			raise UcsValidationException(
				"UCS transaction in progress. Cannot execute StartKvmSession. Complete or Undo UCS transaction.")
		# raise Exception("UCS transaction in progress. Cannot execute StartKvmSession. Complete or Undo UCS transaction.")

		if ((blade != None and rackUnit != None) or (serviceProfile != None and rackUnit != None) or (
						blade != None and serviceProfile != None)):
			raise UcsValidationException("Please provide only one parameter from blade, rackUnit and service profile.")
		# raise Exception("Please provide only one parameter from blade, rackUnit and service profile.")

		if (serviceProfile == None and blade == None and rackUnit == None):
			raise UcsValidationException(
				"Please provide at least one parameter from blade, rackUnit and service profile.")
		# raise Exception("Please provide at least one parameter from blade, rackUnit and service profile.")

		minVersion = UcsVersion('1.4(1a)')
		if self._version < minVersion:
			raise UcsValidationException(
				"StartKvmSession not supported for Ucs version older than %s. You are connected to Ucs Version %s" % (
					minVersion, self._version))
		# raise Exception("StartKvmSession not supported for Ucs version older than %s. You are connected to Ucs Version %s" %(minVersion, self._version))

		PARAM_CENTRALE_PASSWORD = "centralePassword"
		PARAM_CENTRALE_USER = "centraleUser"
		PARAM_DN = "dn"
		PARAM_FRAME_TITLE = "frameTitle"
		PARAM_KVM_IP_ADDR = "kvmIpAddr"
		PARAM_KVM_PASSWORD = "kvmPassword"
		PARAM_KVM_PN_DN = "kvmPnDn"
		PARAM_KVM_USER = "kvmUser"
		PARAM_TEMP_UNPW = "tempunpw"
		PARAM_KVM_DN = "kvmDn"

		_lock = Lock()
		sp_bool = False
		nvc = {}
		dn = None
		pnDn = None
		ipAddress = None

		if ((blade != None) or (rackUnit != None)):
			if (blade != None):
				pnDn = blade.getattr("Dn")
			else:
				pnDn = rackUnit.getattr("Dn")

			nvc[PARAM_DN] = pnDn
			if (frameTitle == None):
				frameTitle = self._ucs + ':' + pnDn + ' KVM Console'

			nvc[PARAM_FRAME_TITLE] = frameTitle
			nvc[PARAM_KVM_PN_DN] = pnDn

			cs = self.ConfigScope(dn=pnDn, inClass=NamingId.MGMT_IF, inFilter=None, inRecursive=YesOrNo.FALSE,
								  inHierarchical=YesOrNo.FALSE, dumpXml=dumpXml)
			if (cs.errorCode == 0):
				for mgmtIf in cs.OutConfigs.GetChild():
					if ((mgmtIf.getattr("Subject") == MgmtIf.CONST_SUBJECT_BLADE) and (
								mgmtIf.getattr("AdminState") == MgmtIf.CONST_ADMIN_STATE_ENABLE)):
						ipAddress = mgmtIf.getattr("ExtIp")
			else:
				raise UcsException(cs.errorCode, cs.errorDescr)
			# raise Exception('[Error]: StartKvmSession [Code]:' + cs.errorCode + ' [Description]:' + cs.errorDescr)

			# If the blade does not have an IP, check if a service profile is associated
			if ((ipAddress == None) or (ipAddress == '0.0.0.0')):
				crDn = self.ConfigResolveDn(pnDn, inHierarchical=YesOrNo.TRUE, dumpXml=dumpXml)
				if (crDn.errorCode != 0):
					raise UcsException(crDn.errorCode, crDn.errorDescr)
				# raise Exception('[Error]: StartKvmSession [Code]:' + crDn.errorCode + ' [Description]:' + crDn.errorDescr)

				for mo in crDn.OutConfig.GetChild():
					dn = mo.getattr("AssignedToDn")
				if dn != None:
					sp_bool = True

		if (sp_bool or serviceProfile != None):
			if dn == None:
				dn = serviceProfile.getattr("Dn")
				if (frameTitle == None):
					frameTitle = self._ucs + ':' + dn + ' KVM Console'
				nvc[PARAM_FRAME_TITLE] = frameTitle

			nvc[PARAM_KVM_DN] = dn
			crDn = self.ConfigResolveDn(dn, inHierarchical=YesOrNo.TRUE, dumpXml=dumpXml)
			if (crDn.errorCode != 0):
				raise UcsException(crDn.errorCode, crDn.errorDescr)
			# raise Exception('[Error]: StartKvmSession [Code]:' + crDn.errorCode + ' [Description]:' + crDn.errorDescr)

			spMo = None
			for mo in crDn.OutConfig.GetChild():
				spMo = mo
			if spMo == None:
				raise Exception('Service Profile not found.')

			if spMo.getattr("PnDn") == None:
				raise UcsValidationException('Service Profile is not associated with blade or rackUnit.')
			# raise Exception('Service Profile is not associated with blade or rackUnit.')

			pnDn = spMo.getattr("PnDn")
			nvc[PARAM_DN] = pnDn

			crc = self.ConfigResolveChildren('vnicIpV4Addr', dn, None, inHierarchical=YesOrNo.FALSE,
											 dumpXml=dumpXml)  # TODO:replace classId with proper constantafter generating mos.py or Constant.py
			if (crc.errorCode == 0):
				for mo in crc.OutConfigs.GetChild():
					gmo = _GenericMO(mo=mo, option=WriteXmlOption.All)
					if not ('Addr' in gmo.properties):
						continue

					ipAddress = gmo.GetAttribute('Addr')
					if ipAddress != None:
						break
			else:
				raise UcsException(crc.errorCode, crc.errorDescr)
				# raise Exception('[Error]: StartKvmSession [Code]:' + crc.errorCode + ' [Description]:' + crc.errorDescr)

		if (((ipAddress == None) or (ipAddress == '0.0.0.0')) and (serviceProfile != None)):
			cs = self.ConfigScope(dn=pnDn, inClass=NamingId.MGMT_IF, inFilter=None, inRecursive=YesOrNo.FALSE,
								  inHierarchical=YesOrNo.FALSE, dumpXml=dumpXml)
			if (cs.errorCode == 0):
				for mgmtIf in cs.OutConfigs.GetChild():
					if ((mgmtIf.getattr("Subject") == MgmtIf.CONST_SUBJECT_BLADE) and (
								mgmtIf.getattr("AdminState") == MgmtIf.CONST_ADMIN_STATE_ENABLE)):
						ipAddress = mgmtIf.getattr("ExtIp")
			else:
				raise UcsException(cs.errorCode, cs.errorDescr)
				# raise Exception('[Error]: StartKvmSession [Code]:' + cs.errorCode + ' [Description]:' + cs.errorDescr)

		if ((ipAddress == None) or (ipAddress == '0.0.0.0')):
			raise UcsValidationException("No assigned IP address to use.")
		# raise Exception("No assigned IP address to use.")

		nvc[PARAM_KVM_IP_ADDR] = ipAddress
		cat = self.AaaGetNComputeAuthTokenByDn(pnDn, 2, dumpXml=dumpXml)
		if (cat.errorCode == 0):
			nvc[PARAM_CENTRALE_PASSWORD] = cat.OutTokens.split(',')[0]
			nvc[PARAM_CENTRALE_USER] = cat.OutUser
			nvc[PARAM_KVM_PASSWORD] = cat.OutTokens.split(',')[1]
			nvc[PARAM_KVM_USER] = cat.OutUser
		else:
			raise UcsException(cat.errorCode, cat.errorDescr)
		# raise Exception('[Error]: StartKvmSession [Code]:' + cat.errorCode + ' [Description]:' + cat.errorDescr)

		nvc[PARAM_TEMP_UNPW] = "true"
		kvmUrl = '%s/ucsm/kvm.jnlp?%s' % (self.Uri(), urllib.urlencode(nvc))

		installPath = UcsUtils.GetJavaInstallationPath()
		if installPath != None:
			subprocess.call([installPath, kvmUrl])
		else:
			# TODO: Add Warning/Error messages in Logger.
			WriteUcsWarning("Java is not installed on System.")
			p = subprocess.Popen(kvmUrl)