4

We have SmartTarget implemented on a page which has multiple regions. To facilitate this we have multiple SmartTarget query tags sitting on the .jsp page to perform the queries and fill in the page with our promotions. However, we have noticed that seemingly randomly one or more of the regions will revert to the default component presentations rather than the expected ST response.

This could happen for 1 or more regions on the page and seems to be completely random each time we refresh the page. Upon refresh we get 0, 1, 2, or more regions that default to their fallback component presentations.

Digging into the logs on localhost we see the following stack trace for each of these failed queries:

2019-10-31 16:30:43,807 DEBUG TimeoutQueryRunner - Started fredhopper query call
2019-10-31 16:30:44,156 ERROR TimeoutQueryRunner - The fredhopper query thread had an exception during execution
java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:206)
    at com.tridion.smarttarget.tags.TimeoutQueryRunner.executeQuery(TimeoutQueryRunner.java:61)
    at com.tridion.smarttarget.tags.QueryTagHandler.executeQuery(QueryTagHandler.java:578)
    at com.tridion.smarttarget.tags.QueryTagHandler.doAfterBody(QueryTagHandler.java:494)
    ...
Caused by: java.lang.ArrayIndexOutOfBoundsException: null
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:598)
    at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
    at java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:735)
    at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:160)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at com.tridion.smarttarget.query.PromotionMetaDataConverter.convert(PromotionMetaDataConverter.java:46)
    at org.dozer.MappingProcessor.mapUsingCustomConverterInstance(MappingProcessor.java:977)
    at org.dozer.MappingProcessor.mapUsingCustomConverter(MappingProcessor.java:1017)
    at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:364)
    at org.dozer.MappingProcessor.mapField(MappingProcessor.java:307)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:267)
    at org.dozer.MappingProcessor.mapToDestObject(MappingProcessor.java:216)
    at org.dozer.MappingProcessor.createByCreationDirectiveAndMap(MappingProcessor.java:196)
    at org.dozer.MappingProcessor.mapCustomObject(MappingProcessor.java:512)
    at org.dozer.MappingProcessor.mapOrRecurseObject(MappingProcessor.java:465)
    at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:361)
    at org.dozer.MappingProcessor.mapField(MappingProcessor.java:307)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:267)
    at org.dozer.MappingProcessor.mapToDestObject(MappingProcessor.java:216)
    at org.dozer.MappingProcessor.createByCreationDirectiveAndMap(MappingProcessor.java:196)
    at org.dozer.MappingProcessor.mapGeneral(MappingProcessor.java:170)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:104)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:99)
    at org.dozer.DozerBeanMapper.map(DozerBeanMapper.java:120)
    at com.sdl.web.experience.util.mapper.EntityMapper.mapFromEdmResultSet(EntityMapper.java:74)
    at com.sdl.web.experience.query.QueryRest.execute(QueryRest.java:42)
    at com.tridion.smarttarget.tags.TimeoutQueryRunner$1.call(TimeoutQueryRunner.java:51)
    at com.tridion.smarttarget.tags.TimeoutQueryRunner$1.call(TimeoutQueryRunner.java:46)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    ... 1 common frames omitted
Caused by: java.lang.ArrayIndexOutOfBoundsException: 15
    at java.util.ArrayList.add(ArrayList.java:463)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:291)
    at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:731)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.execLocalTasks(ForkJoinPool.java:1040)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1058)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
2019-10-31 16:30:44,156 ERROR TimeoutQueryRunner - The fredhopper query thread had an exception during execution
java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:206)
    at com.tridion.smarttarget.tags.TimeoutQueryRunner.executeQuery(TimeoutQueryRunner.java:61)
    at com.tridion.smarttarget.tags.QueryTagHandler.executeQuery(QueryTagHandler.java:578)
    at com.tridion.smarttarget.tags.QueryTagHandler.doAfterBody(QueryTagHandler.java:494)
    ...
Caused by: java.lang.ArrayIndexOutOfBoundsException: null
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:598)
    at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
    at java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:735)
    at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:160)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at com.tridion.smarttarget.query.PromotionMetaDataConverter.convert(PromotionMetaDataConverter.java:46)
    at org.dozer.MappingProcessor.mapUsingCustomConverterInstance(MappingProcessor.java:977)
    at org.dozer.MappingProcessor.mapUsingCustomConverter(MappingProcessor.java:1017)
    at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:364)
    at org.dozer.MappingProcessor.mapField(MappingProcessor.java:307)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:267)
    at org.dozer.MappingProcessor.mapToDestObject(MappingProcessor.java:216)
    at org.dozer.MappingProcessor.createByCreationDirectiveAndMap(MappingProcessor.java:196)
    at org.dozer.MappingProcessor.mapCustomObject(MappingProcessor.java:512)
    at org.dozer.MappingProcessor.mapOrRecurseObject(MappingProcessor.java:465)
    at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:361)
    at org.dozer.MappingProcessor.mapField(MappingProcessor.java:307)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:267)
    at org.dozer.MappingProcessor.mapToDestObject(MappingProcessor.java:216)
    at org.dozer.MappingProcessor.createByCreationDirectiveAndMap(MappingProcessor.java:196)
    at org.dozer.MappingProcessor.mapGeneral(MappingProcessor.java:170)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:104)
    at org.dozer.MappingProcessor.map(MappingProcessor.java:99)
    at org.dozer.DozerBeanMapper.map(DozerBeanMapper.java:120)
    at com.sdl.web.experience.util.mapper.EntityMapper.mapFromEdmResultSet(EntityMapper.java:74)
    at com.sdl.web.experience.query.QueryRest.execute(QueryRest.java:42)
    at com.tridion.smarttarget.tags.TimeoutQueryRunner$1.call(TimeoutQueryRunner.java:51)
    at com.tridion.smarttarget.tags.TimeoutQueryRunner$1.call(TimeoutQueryRunner.java:46)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    ... 1 common frames omitted
Caused by: java.lang.ArrayIndexOutOfBoundsException: 15
    at java.util.ArrayList.add(ArrayList.java:463)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:291)
    at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:731)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.execLocalTasks(ForkJoinPool.java:1040)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1058)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
2019-10-31 16:30:44,157 DEBUG TimeoutQueryRunner - Query result retrieved from fredhopper in: 350 ms.
2019-10-31 16:30:44,157 DEBUG TimeoutQueryRunner - Query result retrieved from fredhopper in: 350 ms.
2019-10-31 16:30:44,186 ERROR PromotionsTagHandler - No Promotions found; is the query server running?
2019-10-31 16:30:44,186 DEBUG ItemTemplateTagHandler - preparing to loop over 0 objects
2019-10-31 16:30:44,186 DEBUG FallbackContentTagHandler - There is no resultset present, evaluating fallback content body

We are on Web 8.5 and using the query micro-service. When checking the response that the query service gets back from fredhopper, we found that there is no difference between the CP returned during a failed attend and successful attempt. It appears the query service gets the full HTML of the CP from fredhopper as expected and throws. The query is successful, but on the webapp side we get the above exception thrown.

We are using the following dependencies for SmartTarget:

        <dependency>
            <groupId>com.tridion.smarttarget</groupId>
            <artifactId>smarttarget_core</artifactId>
            <version>8.5.0.270</version>
            <scope>${dependency.scope}</scope>
        </dependency>
        <dependency>
            <groupId>com.tridion.smarttarget</groupId>
            <artifactId>smarttarget_entitymodel</artifactId>
            <version>8.5.0.270</version>
            <scope>${dependency.scope}</scope>
        </dependency>

Any ideas as to why we might see this exception thrown randomly on the webapp despite the consistent successful query service response?

Edit: Note that duplicates are allowed on a page and we are able to see duplicates appear at times when appropriate.

Edit 2: Through further debugging and logging we were able to obtain the following log which occurs for every failed promotion:

2019-11-11 18:23:41,649 ERROR MappingProcessor - Field mapping error -->
  MapId: null
  Type: null
  Source parent class: com.sdl.web.experience.model.ResultSet
  Source field name: promotionsMetaData
  Source field type: class com.sdl.web.experience.model.PromotionsMetaData
  Source field value: com.sdl.web.experience.model.PromotionsMetaData@79e3e19f
  Dest parent class: com.tridion.smarttarget.query.ResultSetImpl
  Dest field name: promotionsMetaData
  Dest field type: com.tridion.smarttarget.promotions.MetaData.PromotionsMetaData
java.lang.ArrayIndexOutOfBoundsException: null
    at sun.reflect.GeneratedConstructorAccessor109.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:598)
    at java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)
    at java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:735)
    at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:160)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at com.tridion.smarttarget.query.PromotionMetaDataConverter.convert(PromotionMetaDataConverter.java:46)
    at org.dozer.MappingProcessor.mapUsingCustomConverterInstance(MappingProcessor.java:977)
    at org.dozer.MappingProcessor.mapUsingCustomConverter(MappingProcessor.java:1017)
    at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:364)
    at org.dozer.MappingProcessor.mapField(MappingProcessor.java:307)
  • 2
    Do you allow duplicates on a page or not? – Marko Milic Nov 1 '19 at 10:30
  • We do, good question. I've updated my question above. – Nicholas Wetmore Nov 1 '19 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.