Expand my Community achievements bar.

SOLVED

\/bin/querybuilder.json calls are throwing java.lang.ClassCastException

Avatar

Level 4

We are using querybuilder to retrive teh asset information from DAM.

eg - /bin/querybuilder.json?fulltext=%test%5d*&orderby.sort=asc&p.limit=-1&path=%2fcontent%2fdam%2test%2f&type=dam%3aAsset

All of a sudden we have started getting errors the below error in our prod env. Dev, stage and local env are working just fine.

14.05.2019 14:33:39.546 *ERROR* [10.13.4.11 [1557844419377] GET /bin/querybuilder.json HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught Throwable

java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Calendar

    at com.day.cq.search.writer.SimpleHitWriter.writeSimpleJson(SimpleHitWriter.java:77)

    at com.day.cq.search.writer.SimpleHitWriter.write(SimpleHitWriter.java:41)

    at com.day.cq.search.impl.servlets.QueryBuilderJsonServlet.writeHits(QueryBuilderJsonServlet.java:165)

    at com.day.cq.search.impl.servlets.QueryBuilderJsonServlet.handleQuery(QueryBuilderJsonServlet.java:113)

    at com.day.cq.search.impl.servlets.QueryBuilderJsonServlet.doGet(QueryBuilderJsonServlet.java:73)

Caused by: java.lang.NumberFormatException: For input string: "2019-04-26T15:00:25.884Z"

    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

    at java.lang.Long.parseLong(Long.java:589)

    at java.lang.Long.parseLong(Long.java:631)

    at org.apache.jackrabbit.oak.plugins.value.Conversions$Converter.toLong(Conversions.java:80)

    at org.apache.jackrabbit.oak.segment.SegmentPropertyState.getValue(SegmentPropertyState.java:211)

    at org.apache.jackrabbit.oak.segment.SegmentPropertyState.getValue(SegmentPropertyState.java:183)

    at org.apache.jackrabbit.oak.plugins.value.ValueImpl.getValue(ValueImpl.java:381)

    at org.apache.jackrabbit.oak.plugins.value.ValueImpl.getLong(ValueImpl.java:256)

We have checked the contents and there are no issues with the cq:lastModdified or jcr:lastModified values of the assets. We have also checked that all the bundles and components are up and running. We also started AEM instance but that did not help.

Attached is the screen shot of the code from the OOTB component com.day.cq.search.writer.SimpleHitWriter from com.day.cq.search bundle.

I also noticed that I see the below error as well, not sure if it is related-

14.05.2019 14:33:28.243 *ERROR* [10.13.4.8 [1557844407443] GET /assets.html/content/dam/cdw/photography/stock-images HTTP/1.1] com.day.cq.dam.commons.util.UIHelper error creating cache killer

javax.jcr.ValueFormatException: Error converting value to long

    at org.apache.jackrabbit.oak.plugins.value.ValueImpl.getLong(ValueImpl.java:262)

    at org.apache.jackrabbit.oak.jcr.session.PropertyImpl.getLong(PropertyImpl.java:292)

    at com.day.cq.dam.commons.util.UIHelper.getCacheKiller(UIHelper.java:169)

    at org.apache.jsp.apps.dam.gui.coral.components.admin.contentrenderer.row.asset.asset_jsp._jspService(asset_jsp.java:1067)

All the asset operations like browse, create, update etc working just fine for the user except the querybuilder.json API call.

could it be possible that one of the maintenance task might have corrupted the repository?  But it all started after Sunday night's regular maintenance.
Does anyone have any idea how to fix this issue? should we run any oak clean up etc? Can someone please guide?

Screen Shot 2019-05-15 at 11.43.50 AM.png

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

It seems there is a content in your PROD environment which has String data type for "cq:lastModified" or "jcr:lastModified" instead of Date.

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

It seems there is a content in your PROD environment which has String data type for "cq:lastModified" or "jcr:lastModified" instead of Date.

Avatar

Level 4

Hello Kunal,  Thank you very much.

I see that jcr:lastModified is saved as String type in Prod whereas in Dev it is a Date. It seems like someone is programmatically creating assets with the wrong type in prod. We will investigate further.