Sitecore throwing errors when starting page test run or saving a test

I had experience Optimization disabled before but now it is enabled. I am getting an error of "An error occurred during save. Your test may not have been saved." on experience optimization page when trying to run a page test or save a test. I checked the MongoDB service and is running well. Default/anonymous also has read access. Connection string is also there.When I checked the sitecore error log the error behind the scene was:

ERROR Exception when executing agent experienceAnalytics/reduce/agent
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Reflection.ReflectionUtil.CreateObject(Type type, Object[] parameters)
at Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
at Sitecore.Configuration.Factory.CreateObject[T](XmlNode configNode)
at Sitecore.ExperienceAnalytics.Reduce.ReduceAgent.Execute()
at Sitecore.Analytics.Core.BackgroundService.Run()

Nested Exception

Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Reflection.ReflectionUtil.CreateObject(Type type, Object[] parameters)
at Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)
at Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
at Sitecore.Configuration.Factory.CreateObject[T](XmlNode configNode)
at Sitecore.ExperienceAnalytics.Core.CoreContainer.Repositories.GetDimensionDefinitionService()
at Sitecore.ExperienceAnalytics.Reduce.ReduceWorker..ctor(String connectionString)
at Sitecore.ExperienceAnalytics.Reduce.ReduceManager..ctor(String connectionStringName, String triggerHour, String retentionDays)

Nested Exception

Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Reflection.ReflectionUtil.CreateObject(Type type, Object[] parameters)
at Sitecore.ExperienceAnalytics.Core.Repositories.DimensionDefinitionService.CreateDimensionFromConfig(XmlElement childNode)
at Sitecore.ExperienceAnalytics.Core.Repositories.DimensionDefinitionService.LoadDimensionsFromConfig(String pathToConfigNode)

Nested Exception

Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Marketing.Taxonomy
at Sitecore.Marketing.Taxonomy.Extensions.TaxonomyManagerProviderExtensions.GetChannelManager(ITaxonomyManagerProvider provider)
at Sitecore.ExperienceAnalytics.Aggregation.Dimensions.ByChannelType..ctor(Guid dimesionId)

 

If anyone could help me out please.