Expand my Community achievements bar.

Component throws 'jcr:lastModified' can't be put into node error

Avatar

Level 4

Hi everyone. 
Would like to ask how to fix this one. I have a component developed. Then at some point I can't add it anymore to the template and it just shows

LyonMartin_0-1686123667233.png


and the error shows

07.06.2023 15:17:32.313 *WARN* [[0:0:0:0:0:0:0:1] [1686122252303] POST /content/acom/language-masters/***********/jcr:content/root/container_main/ HTTP/1.1] org.apache.sling.servlets.post.impl.SlingPostServlet Exception while handling POST on path [/content/acom/language-masters/*************************/jcr:content/root/container_main] with operation [org.apache.sling.servlets.post.impl.operations.ModifyOperation]
java.lang.IllegalArgumentException: Value 'java.util.GregorianCalendar[time=1686122252311,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Shanghai",offset=28800000,dstSavings=0,useDaylight=false,transitions=31,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2023,MONTH=5,WEEK_OF_YEAR=23,WEEK_OF_MONTH=2,DAY_OF_MONTH=7,DAY_OF_YEAR=158,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=3,HOUR_OF_DAY=15,MINUTE=17,SECOND=32,MILLISECOND=311,ZONE_OFFSET=28800000,DST_OFFSET=0]' for property 'jcr:lastModified' can't be put into node '/content/acom/language-masters/**************************/jcr:content/root/container_main/{component}'.

And the following thread:
Caused by: javax.jcr.nodetype.ConstraintViolationException: No matching property definition: jcr:lastModified = 2023-06-07T15:17:32.311+08:00
    at org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate.setProperty(NodeDelegate.java:514) [org.apache.jackrabbit.oak-jcr:1.42.0.T20220705075745-7aee0b1]
    at org.apache.jackrabbit.oak.jcr.session.NodeImpl$36.perform(NodeImpl.java:1404) [org.apache.jackrabbit.oak-jcr:1.42.0.T20220705075745-7aee0b1]
    at org.apache.jackrabbit.oak.jcr.session.NodeImpl$36.perform(NodeImpl.java:1391) [org.apache.jackrabbit.oak-jcr:1.42.0.T20220705075745-7aee0b1]
    at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:210) [org.apache.jackrabbit.oak-jcr:1.42.0.T20220705075745-7aee0b1]
    at org.apache.jackrabbit.oak.jcr.session.ItemImpl.perform(ItemImpl.java:112) [org.apache.jackrabbit.oak-jcr:1.42.0.T20220705075745-7aee0b1]
    at org.apache.jackrabbit.oak.jcr.session.NodeImpl.internalSetProperty(NodeImpl.java:1391) [org.apache.jackrabbit.oak-jcr:1.42.0.T20220705075745-7aee0b1]
    at org.apache.jackrabbit.oak.jcr.session.NodeImpl.setProperty(NodeImpl.java:368) [org.apache.jackrabbit.oak-jcr:1.42.0.T20220705075745-7aee0b1]
    at org.apache.sling.jcr.resource.internal.JcrModifiableValueMap.put(JcrModifiableValueMap.java:73) [org.apache.sling.jcr.resource:3.2.0]
    ... 170 common frames omitted
14 Replies

Avatar

Level 4

Are you facing this on your local AEM instance?

Can you try removing the jcr:lastModified node from the crx manually.

Avatar

Level 4

Ah, yup. Only on the local.

On which node should I remove the jcr:lastModified?

 

Avatar

Level 4

Are you trying to add/modify the jcr:lastModified via component code ?

Ideally dont do that.

 

Also, create a new page and try adding the component to the page, that will rule out of the issue is with the component or a one of issue with the page/template itself.

Avatar

Level 4

No, I'm not doing anything like that.

And I can't add the component on a new page cause I'm blocked by that (whenever I tried to add it on the page).

I tried adding other components but they worked fine.

Avatar

Level 4

Can you check if you have a jcr:lastModified property in your component, ideally there should not be

Avatar

Level 4

I can't check it as the component can't be added on the page and doesn't get added to the ~/root/container_main of the page

 

Avatar

Level 4

Can you once check the properties of your component in /apps.

See if you find any anomalies 

Avatar

Community Advisor

Hello @LyonMartin ,
Based on your discussion with @maheshp I am guessing the problem is in your newly created component. Since on the page, you can add other components except for the new one.
But it's really difficult to say why this problem occurred without seeing the code.
Still, you can recheck your component properties or create a demo project and try to see what behaves there.

Avatar

Community Advisor

Hello @LyonMartin 

 

The logs refer to path as "/content/acom/language-masters/**************************/jcr:content/root/container_main/{component}"

 

Apologies, it may be my lack of understanding, but what is {component}. This node name seems weird.

 

Is the component creating any default structure or adding default properties?


Aanchal Sikka

Avatar

Level 4

oh, it's just a placeholder for my component. I just didn't named it as maybe I'll be in trouble legally

Basically, it is a component with a carousel as supertype.

Avatar

Community Advisor

Thanks for the clarification @LyonMartin 

 

Second part of the question still remains: Is the component creating any default structure or adding default properties?

 

Aanchal Sikka

Avatar

Level 3

Hi @LyonMartin,

 

I had a similar issue in my local and then I found out that it was caused due to an empty folder in my component structure. I had an empty _cq_template folder (wanted to add a file later) but once I removed that folder, I was able to use my component as intended.

 

So please check if you have any empty files or folders which might cause this issue.

 

Regards,

Ramkumar