NullReferenceException when browsing Sitecore Content Tree - sitecore

We have a Sitecore 6.4 installation (Sitecore.NET 6.4.1 (rev. 110621)), deployed to two servers in a load balanced environment. For one (and only one) of the servers, when you are browsing the content tree in the content editor you receive a stack trace as below. It doesn't always error, but once you do see the error it always happens.
[NullReferenceException: Object reference not set to an instance of an object.]
Sitecore.Shell.Applications.ContentManager.ContentEditorForm.OnLoad(EventArgs e) +1636
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +639
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +35
Sitecore.Reflection.ReflectionUtil.CallMethod(Type type, Object obj, String methodName, Boolean includeNonPublic, Boolean includeInherited, Object[] parameters) +37
Sitecore.Reflection.ReflectionUtil.CallMethod(Object obj, String methodName, Boolean includeNonPublic, Boolean includeInherited, Object[] parameters) +66
Sitecore.Web.UI.Sheer.ClientPage.OnLoad(EventArgs e) +420
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064

As #techphoria414 says, make sure you have read the Scalability Guide and also make sure you have renamed ..Website\App_Config\Include\ScalabilitySettings.config.example to ScalabilitySettings.config and checked the various settings inside that config.

Related

Could not retrieve Coveo for Sitecore license

Getting below Exception while going through the Control panel of Sitecore.
[LicenseNotFoundException: Could not retrieve Coveo for Sitecore license.]
Coveo.SearchProvider.Licensing.Cloud.LicenseRetriever.GetLicense(Boolean p_ForceRetrieve) +274
Coveo.SearchProvider.Licensing.LicenseManager.EnsureValidLicense() +77
Coveo.SearchProvider.Licensing.LicenseManager.GetLicenseInformation() +57
Coveo.SearchProvider.Applications.Shell.Controls.ConfigureCoveoCloudOrganizationWizardFormPage.ReadFormValues() +483
Coveo.SearchProvider.Applications.Shell.Controls.ConfigurationFileUpdaterWizardFormPage`1.ActivePageChangingToNextPage() +108
Coveo.SearchProvider.Applications.Shell.Controls.CoveoWizardForm.ActivePageChanging(String p_CurrentPageId, String& p_NextPageId) +215
Sitecore.Web.UI.Pages.WizardForm.set_Active(String value) +106
Sitecore.Web.UI.HtmlControls.Button.DoClick(Message message) +60
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +221
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +231
Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj) +89
Sitecore.Web.UI.HtmlControls.Component.HandleMessage(Message message) +195
Sitecore.Shell.Framework.Commands.ClientEventCommand.SendEventMessage() +130
Sitecore.Shell.Framework.Commands.ClientEventCommand.Execute(CommandContext context) +16
Sitecore.Web.UI.Sheer.ClientPage.RaiseEvent() +78
Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e) +801
System.Web.UI.Control.PreRenderRecursiveInternal() +200
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7479
Seem to be a known issue on Coveo, does it help? Or could be similar as well.
If none above helps - download iLSpy to see how/where license is looked for.

Issue in publishing whole website after upgrading from 7.1 to 7.2(release)

We have upgraded sitecore version from 7.1 to 7.2 and we are on the last step where we need to publish whole website. When we tried to publish whole website, we are got following error:
Job started: Publish to 'web'|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Could not resolve type name: Sitecore.Publishing.Pipelines.Publish.OverridePublishContext, Sitecore.Kernel (method: Sitecore.Configuration.Factory.CreateType(XmlNode configNode, String[] parameters, Boolean assert)).
at Sitecore.Diagnostics.Error.Raise(String error, String method)
at Sitecore.Configuration.Factory.CreateType(XmlNode configNode, String[] parameters, Boolean assert)
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.Pipelines.CorePipelineFactory.GetObjectFromType(String type, XmlNode processorNode)
at Sitecore.Pipelines.CoreProcessor.GetMethod(Object[] parameters)
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Publishing.Pipelines.Publish.PublishPipeline.Run(PublishContext context)
at Sitecore.Publishing.Publisher.Publish()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(`enter code here`Object obj, Object[] parameters)
at (Object , Object[] )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Jobs.Job.ThreadEntry(Object state)
When having the issue Could not resolve type name, this means that your dlls are not up to date or your config files.
Please check your dlls against dlls from a fresh installation of Sitecore 7.2. Also check the config files. Moreover, check that you dlls have been compiled against the Sitecore 7.2 dlls.
Thanks

Sitecore - Root item is not defined

I've run into the following error while trying to deploy with TDS. I don't believe that there are any custom indexes. I've looked at the following link and cleared my \Data\Indexes folder.
Sitecore Index error - Root Item Not defined
What can cause this error?
Also this is the url I'm getting the error on : http://<hostname>/sitecore
Full stack trace:
[InvalidOperationException: Root item is not defined]
Sitecore.Diagnostics.Assert.IsNotNull(Object value, String message) +59
Sitecore.Search.Crawlers.DatabaseCrawler.Initialize(Index index) +106
Sitecore.Search.Index.AddCrawler(ICrawler crawler) +36
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +1255
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj) +91
Sitecore.Configuration.Factory.AssignProperties(Object obj, Object[] properties) +760
Sitecore.Configuration.Factory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +943
Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +305
Sitecore.Configuration.Factory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert) +858
Sitecore.Configuration.Factory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +795
Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +305
Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert) +395
Sitecore.Search.SearchManager.get_SearchConfig() +71
Sitecore.Search.SearchManager.GetIndex(String id) +43
Sitecore.Shell.Applications.ShellForm.OnLoad(EventArgs e) +1331
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +1255
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj) +91
Sitecore.Web.UI.Sheer.ClientPage.OnLoad(EventArgs e) +332
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
If you browse to this page http://[yourhostname]/sitecore/admin/showconfig.aspx
Search for any instances of the index element and check the <Root>path here</Root> node path actually exists in your content tree
See the default index for an example
<index id="system" type="Sitecore.Search.Index, Sitecore.Kernel">
<param desc="name">$(id)</param>
<param desc="folder">__system</param>
<Analyzer ref="search/analyzer"/>
<locations hint="list:AddCrawler">
<core type="Sitecore.Search.Crawlers.DatabaseCrawler,Sitecore.Kernel">
<Database>core</Database>
<Root>/sitecore/content</Root>
<include hint="list:IncludeTemplate">
<application>{EB06CEC0-5E2D-4DC4-875B-01ADCC577D13}</application>
</include>
<Tags>application</Tags>
<Boost>2.0</Boost>
</core>
<core-controlpanel type="Sitecore.Search.Crawlers.DatabaseCrawler,Sitecore.Kernel">
<Database>core</Database>
<Root>/sitecore/content/applications/control panel</Root>
<include hint="list:IncludeTemplate">
<taskoption>{BDB6FA46-2F76-4BDE-8138-52B56C2FC47E}</taskoption>
</include>
<Tags>taskoption</Tags>
<Boost>1.9</Boost>
</core-controlpanel>
<master type="Sitecore.Search.Crawlers.DatabaseCrawler,Sitecore.Kernel">
<Database>master</Database>
<Tags>master content</Tags>
</master>
</locations>
</index>
Once you correct any invalid Root values the site should work again.
Issue Cause
This problem usually occurs when an Sitecore lucene index has been declared but the <Root> it refers to is not in the database.
Note: If the database the index targets is web this may be cause you haven't published the items.
Issue fix
Because you can't get to the Sitecore desktop you'll have to comment out the index causing the issue. If you don't know which one it is you have to use plain old trial and error because sitecore won't tell you.
To see all indexes you have declared in your system go to http://[yourhostname]/sitecore/admin/showconfig.aspx and search for <index. This is the combination of all configuration declared in App_Config.
An index will look like this:
<index id="MyIndexId" type="Sitecore.Search.Index, Sitecore.Kernel">
Once you find the culprit comment it out then create or deploy the missing root item in Sitecore. Once that's done add the index back in.

Sitecore NullReferenceException when saving the layout page

I have got a NullReferenceException but when i'm trying to save the Layout page.
I'm using the Email Campaing Manager.
I have built a Layout page (ASPX) which contains several placeholder linked to custom Sub Layout (ASCX)
After adding those Sublayout form via the Email manager ("Add to Here"), I m clicking on the save button and receiving the error message:
[NullReferenceException: Object reference not set to an instance of an object.]
Sitecore.Modules.EmailCampaign.Core.MessageRelationsCorrector.ReplaceItemPaths(LayoutDefinition layout) +164
Sitecore.Modules.EmailCampaign.Core.MessageRelationsCorrector.CorrectItemRelations(WebPageMail message) +236
Sitecore.Modules.EmailCampaign.Pipelines.CorrectMessageRelations.Process(SaveArgs args) +268
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +251
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28
Sitecore.Pipelines.Processor.Invoke(PipelineArgs args) +262
Sitecore.Nexus.Pipelines.NexusPipelineApi.Resume(PipelineArgs args, Pipeline pipeline) +225
Sitecore.Pipelines.Pipeline.Resume() +39
Sitecore.Pipelines.Pipeline.DoStart(PipelineArgs args) +115
Sitecore.Pipelines.Pipeline.Start(PipelineArgs args, Boolean atomic) +133
Sitecore.Pipelines.Pipeline.Start(PipelineArgs args) +32
Sitecore.Shell.Applications.WebEdit.Commands.Save.Execute(CommandContext context) +669
Sitecore.Shell.Framework.Dispatcher.Dispatch(Message message, CommandContext context) +62
Sitecore.Shell.Framework.Dispatcher.Dispatch(Message message, Item[] items) +110
Sitecore.Shell.Framework.Dispatcher.Dispatch(Message message, Item item) +78
Sitecore.Shell.Applications.WebEdit.WebEditRibbonForm.HandleMessage(Message message) +429
Sitecore.Shell.Framework.Commands.MessageCommand.Execute(CommandContext context) +447
Sitecore.Web.UI.Sheer.ClientPage.Dispatch(String command) +143
Sitecore.Web.UI.Sheer.ClientPage.RaiseEvent() +108
Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e) +624
Sitecore.Shell.Applications.WebEdit.WebEditRibbon.OnPreRender(EventArgs e) +35
System.Web.UI.Control.PreRenderRecursiveInternal() +103
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
Do you know what could be the reason ? If not, how can i debug those kind of error?
I believe that this issue is related to a newly registered bug in the ECM module and I suspect it may have been you who put the original ticket in since the time frames match. However, if it wasn't you or in the interest of passing this along to others who may be experiencing this issue, in order to get around this, you'll need to put a ticket in to Sitecore support. There is an initial hotfix that if they find that your issue is the same or related, they can provide you the hotfix.

Elmah throws exception when accessing Context.Request.ServerVariables

I'm using Elmah to log exceptions for my website, everything seems to be all working fine until one day I noticed that the 500 server errors are not being caught properly. I'm using following script to specifically ignore errors from ScriptResource.axd file.
<errorFilter>
<test>
<or>
<and>
<regex binding="FilterSourceType.Name" pattern="mail" />
<jscript>
<expression>
<![CDATA[
// #assembly mscorlib
// #assembly System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// #import System.IO
// #import System.Web
(Context.Request.ServerVariables["URL"].match(/ScriptResource\.axd/i) && BaseException instanceof System.FormatException)
]]>
</expression>
</jscript>
</and>
</or>
</test>
It seems to be working fine when the first error is triggered. However, the next time this error is triggered Elmah stopped filtering and fails to send email. I was able to reproduce this problem locally and here's the source of the problem:
Microsoft.JScript.JScriptException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Web.HttpServerVarsCollection.Get(String name)
at invoker2.Invoke(Object , Object[] )
at Microsoft.JScript.JSMethodInfo.Invoke(Object obj, BindingFlags options, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.JScript.LateBinding.CallOneOfTheMembers(MemberInfo[] members, Object[] arguments, Boolean construct, Object thisob, Binder binder, CultureInfo culture, String[] namedParameters, VsaEngine engine, Boolean& memberCalled)
at Microsoft.JScript.LateBinding.Call(Binder binder, Object[] arguments, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters, Boolean construct, Boolean brackets, VsaEngine engine)
at Microsoft.JScript.LateBinding.Call(Object[] arguments, Boolean construct, Boolean brackets, VsaEngine engine)
at Microsoft.JScript.Call.Evaluate()
--- End of inner exception stack trace ---
at Microsoft.JScript.Block.Evaluate()
at Microsoft.JScript.FunctionObject.CallASTFunc(Object[] args, Object thisob, ScriptObject enclosing_scope, Closure calleeClosure, Binder binder, CultureInfo culture)
at Microsoft.JScript.FunctionObject.Call(Object[] args, Object thisob, ScriptObject enclosing_scope, Closure calleeClosure, Binder binder, CultureInfo culture)
at Microsoft.JScript.Closure.Call(Object[] args, Object thisob, Binder binder, CultureInfo culture)
at Microsoft.JScript.LateBinding.CallValue(Object val, Object[] arguments, Boolean construct, Boolean brackets, VsaEngine engine, Object thisob, Binder binder, CultureInfo culture, String[] namedParameters)
at Microsoft.JScript.LateBinding.CallValue(Object thisob, Object val, Object[] arguments, Boolean construct, Boolean brackets, VsaEngine engine)
at Elmah.Assertions.JScriptAssertion.FullTrustEvaluationStrategy.Eval(Object context) in C:\workspace\v2_psp\Elmah\src\Elmah\Assertions\JScriptAssertion.cs:line 312
What I don't understand is how and why this occurs. I also tried other ServerVariables and so far I found out that HTTPS, HTTP_REFERER will NOT trigger this error when the same exception happen the second time. While URL, SCRIPT_NAME, PATH_INFO, PATH_TRANSLATED WILL trigger this error.
Thoughts?
Okay! After further digging, it seems like you will NOT be able to access any of the DynamicServerVariable from ServerVariables["XXX"] when using Elmah's JScriptAssertion. However, I did found a workaround, seems like these DynamicServerVariable have public properties mapping on the HttpRequest object!!
Therefore, in my case where I'd like to access Context.Request.ServerVariables["URL"], I can replace the code with Context.Request.FilePath, which is how "URL" is mapped to in the HttpRequest object. This way, the JScriptAssertion would not throw exception when the exception is thrown the second time around.
Following are DynamicServerVariable and their properties mapping in HttpRequest.
ServerVariables HttpRequest Property
URL FilePath
SCRIPT_NAME FilePath (Same as URL)
PATH_INFO Path
PATH_TRANSLATED PhysicalPathInternal
QUERY_STRING QueryStringText
AUTH_TYPE if (_context.User != null && _context.User.Identity.IsAuthenticated) Context.User.Identity.AuthenticationType, otherwise String.empy
AUTH_USER if (_context.User != null && _context.User.Identity.IsAuthenticated) Context.User.Identity.Name, otherwise String.empty
REMOTE_USER if (_context.User != null && _context.User.Identity.IsAuthenticated) Context.User.Identity.Name, otherwise String.empty (Same as AUTH_USER)