Highlighted

"String is too long" error when attempting to retrieve jcr:data

Avatar

Avatar

b7wilso

Avatar

b7wilso

b7wilso

09-06-2016

    java.lang.IllegalStateException: String is too long: 2318847350793139939 at org.apache.jackrabbit.oak.plugins.segment.Segment.loadString(Segment.java:397) at org.apache.jackrabbit.oak.plugins.segment.Segment.readString(Segment.java:364) at org.apache.jackrabbit.oak.plugins.segment.Segment.readString(Segment.java:358) at org.apache.jackrabbit.oak.plugins.segment.SegmentPropertyState.getValue(SegmentPropertyState.java:174) at org.apache.jackrabbit.oak.plugins.segment.SegmentPropertyState.getValue(SegmentPropertyState.java:165) at org.apache.jackrabbit.oak.plugins.value.ValueImpl.getValue(ValueImpl.java:381) at org.apache.jackrabbit.oak.plugins.value.ValueImpl.getOakString(ValueImpl.java:144) at org.apache.jackrabbit.oak.plugins.value.ValueImpl.getString(ValueImpl.java:287) at org.apache.jackrabbit.oak.jcr.session.PropertyImpl.getString(PropertyImpl.java:273)

I believe this to be a similar question to http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

So for the situation I am testing I have a file that I am trying to reference in the repository.  I tried this with the "basic" file (two records of 8 lines each) and was unable to reproduce the error in the test regions.  On the other hand I test with the actual file (> 140 records) that I am hoping to reference as soon as I try to pull back the string I get this error.  So for now, I am going to work around this by splitting up the file which should allow me to pull back each file by itself and get what I need from it.

What my actual question is why is there a limit and is there a way to override it for this situation only?  I only ask because the solution I am using currently works fine on my Windows 10 based machine but gets this error in both of our test regions (and I am assuming our Prod region, but I am not going to test that for obvious reasons) which are Linux based.

BTW, we are on AEM 6.1 and have the hotfix installed so we are on Apache Jackrabbit Oak 1.2.14.

Thanks in advance for any help that you can provide.

Brad W.

Replies

Highlighted

Avatar

Avatar

bsloki

MVP

Total Posts

1.9K

Likes

172

Correct Answer

544

Avatar

bsloki

MVP

Total Posts

1.9K

Likes

172

Correct Answer

544
bsloki
MVP

09-06-2016

Please raise a support ticket to quickly see if they have any workarounds already !

Highlighted

Avatar

Avatar

kautuk_sahni

Community Manager

Total Posts

5.6K

Likes

961

Correct Answer

1.1K

Avatar

kautuk_sahni

Community Manager

Total Posts

5.6K

Likes

961

Correct Answer

1.1K
kautuk_sahni
Community Manager

10-06-2016

Please file a day care ticket for this: https://daycare.day.com/home/createaticket.html 

Thanks and Regards

Kautuk Sahni

Highlighted

Avatar

Avatar

Tom_Fought

Avatar

Tom_Fought

Tom_Fought

17-05-2017

Was an answer to this issue ever provided?

I was running the "debug" option on my oak 1.4.9 repository today and received the same exception.

Exception in thread "main" java.lang.IllegalStateException: String is too long: 2318847148929820343
        at org.apache.jackrabbit.oak.plugins.segment.Segment.loadString(Segment.java:533)

Highlighted

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

17-05-2017

Contact the Support team - there may be a hotfix. 

Highlighted

Avatar

Avatar

nafeeskhanp7683

Avatar

nafeeskhanp7683

nafeeskhanp7683

09-09-2019

I am facing a similar issue in AEM 6.5.1. Is there any solution for this?

Highlighted

Avatar

Avatar

Jean-foxfly

Avatar

Jean-foxfly

Jean-foxfly

21-07-2020

Hi @nafeeskhanp7683
Probably the problem that you have is the size of file.
To read big .TXT files you will need to open it as Stream and read parts until the EOF (End of File).

This isn't a good code, but is a sample reading by byte.

var csvBin = workflowSession.getSession().getNode(path + "/attachments/csvUpload/" + csvName + "/jcr:content").getProperty("jcr:data").getBinary();
        var csvStream = csvBin.getStream()
        var csv = [];
        while(1) {
            var csvLine = [];
            var endFlag = false;
            while(1) {
                var charCode = csvStream.read();
                if(charCode == -1) {
                    endFlag = true;
                    break;
                }
                var char =  String.fromCharCode(charCode);
                if(char == "\n") break;
                csvLine.push(char);
            }
            if(endFlag == true) break;
            csv.push(csvLine.join(""));
        }