Thursday, 17 June 2021

Rich Text Editor “Object reference not set to an instance of an object.” Issue



 There are situation, where on the click of show editor button for RTE field on an item may get issue as 

Rich Text Editor “Object reference not set to an instance of an object.” yellow screen error as popup


To resolve this issue there are few approach to verify (is there any item missing in CORE DB)

Apporach-1:
In Sitecore CMS, switch to Core db from right botton (Desktop view screen).
After that go to path /sitecore/system/Settings/Html Editor Profiles and verify that all expected RTE items exist or not?

Can check number of RTE items from working same instance (from other upper env, dev instance).

If any mismatch, then create package from there and installed at target instance.

IT works for me.

Apporach-2:


and see issue, if it works then approach 1 will be the fix.


Hope this will.

Friday, 4 June 2021

Sitecore solr MaxBytesLengthExceededException issue while index rebuild

While triggering index rebuild from Sitecore control Panel, may get below issue as

SolrNet.Exceptions.SolrConnectionException: <?xml version="1.0" encoding="UTF-8"?>

<response>

<lst name="responseHeader">

<int name="status">400</int><int name="QTime">2147</int></lst><lst name="error">

<lst name="metadata"><str name="error-class">org.apache.solr.common.SolrException</str>

<str name="root-error-class">org.apache.lucene.util.BytesRefHash$MaxBytesLengthExceededException</str></lst>

<str name="msg">Exception writing document id sitecore://web/{629c0a43-8382-4aa6-10e8-eb2c0fd5460a}?lang=en&amp;ver=2&amp;ndx=YOUR_INDEXNAME

to the index; possible analysis error: Document contains at least one immense term in field="INDEXEDFIELDNAME" (whose UTF8 encoding is longer than the max length 32766),

all of which were skipped.  Please correct the analyzer to not produce such terms.  The prefix of the first immense term is: '[72, 117, 109, 97, 110, 32, 82, 101, 115, 111, 117, 114, 99, 101, 115, 32, 124, 32, 52, 48, 48, 32, 124, 32, 50, 53, 32, 124, 32, 87]...', 

original message: bytes can be at most 32766 in length; got 58214

Perhaps the document has an indexed string field (solr.StrField) which is too large</str><int name="code">400</int></lst>

</response>

 ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.


Possible Fix:

As I tried to highlight useful information from above log and it seems that we are facing size issue for string Field type in solr.

string Field have max size of 32K (32766) and trying to store 58214 char that is why got exception.

one solution is to change fieldType

From the computed Index configuration file, change returnType for indexField as "Text" after removing "String"

This works for me, hope for you as well.

another solution is to bypass index for this particular file. For that there is a setting in config StoreLocation="true" but I do not feel this will be good approach.