[#10886] - "No results" error for all MongoDbQuery aggregation queries

Category:
Bug report
Priority:
Immediate
Status:
Feedback Requested
Project: Severity:
Critical
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:
24

JasperReports does not recognize MongoDB response for an aggregation query. Please consider this simple use case (code examples edited for brevity):

MongoDB collection schema:

{
"_id" : ObjectId("5a6fca214420c2302a6f8985"),
"report_date_num" : NumberInt(20180129),
...
}

Query in JR Studio:
{
"runCommand": {
"aggregate" : "reporting",
"pipeline" :[
{
"$match": {
"report_date_num": {
"$gte": 20180122,
"$lte": 20180122
}
}
},
...
] ,
"cursor": {}
}
}

Error in JR Studio:
net.sf.jasperreports.engine.JRException: No results
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.runCommand(MongoDbQueryWrapper.java:214)
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.processQuery(MongoDbQueryWrapper.java:115)
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.<init>(MongoDbQueryWrapper.java:93)
at com.jaspersoft.mongodb.MongoDbFieldsProvider.getFields(MongoDbFieldsProvider.java:81)
at com.jaspersoft.studio.data.mongodb.MongoDbFieldsProvider.getFields(MongoDbFieldsProvider.java:38)
at com.jaspersoft.studio.data.mongodb.MongoDbDataAdapterDescriptor.getFields(MongoDbDataAdapterDescriptor.java:64)
at com.jaspersoft.studio.property.dataset.dialog.DataQueryAdapters.doGetFields(DataQueryAdapters.java:518)
at com.jaspersoft.studio.data.designer.AQueryDesignerContainer$1.run(AQueryDesignerContainer.java:49)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)

The same query executed in MongoDB shell (using db.runCommand()) returns response:
{
"cursor" : {
"firstBatch" : [
{
"_id" : "...",
...
}
],
"id" : NumberLong(0),
"ns" : "reporting"
},
"ok" : 1
}

NOTE: when query is executed with option "cursor": {batchSize:1}, a cursor is being returned in MongoDB shell ("id" key in the response document contains ID of cursor, e.g. "id" : NumberLong("8582786882192706121"), but same "No results" error is thrown in JR Studio. Example of the response in MongoDB shell:

{
"cursor" : {
"firstBatch" : [
{
"_id" : "...",
...
}
],
"id" : NumberLong("8582786882192706121"),
"ns" : "reporting"
},
"ok" : 1
}

I believe that despite the statements in the documentation (https://community.jaspersoft.com/wiki/jaspersoft-mongodb-query-language), JasperReports is unable to read MongoDB responses to aggregation queries, which is an obvious bug.

Versions: JasperReports Studio: 6.5.1 final, MongoDB 3.2.12 and 3.6.2.

v6.5.1
pjacekm's picture
34
Joined: Feb 17 2017 - 7:07pm
Last seen: 4 weeks 9 hours ago

19 Comments:

#1

please give solution as soon as possible

#2
  • Status:New» Feedback Requested

Hi I moved the bug to the "MongoDB Connector" tracker. This seems to be not something related to JSS itself.
Can you give it a try with the latest JSS 6.6.0? In there we ship the latest connector provided using the mongo-java-driver-3.6.3 library.
It might work.

Regards,
Massimo.

#3

Hi Massimo, thank you for your response. I have updated JSS to 6.6.0 final and reran the query against MongoDB 3.6.2.
Unfortunately, the error persists:

net.sf.jasperreports.engine.JRException: No results
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.runCommand(MongoDbQueryWrapper.java:214)
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.processQuery(MongoDbQueryWrapper.java:115)
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.<init>(MongoDbQueryWrapper.java:93)
at com.jaspersoft.mongodb.MongoDbFieldsProvider.getFields(MongoDbFieldsProvider.java:81)
at com.jaspersoft.studio.data.mongodb.MongoDbFieldsProvider.getFields(MongoDbFieldsProvider.java:38)
at com.jaspersoft.studio.data.mongodb.MongoDbDataAdapterDescriptor.getFields(MongoDbDataAdapterDescriptor.java:64)
at com.jaspersoft.studio.property.dataset.dialog.DataQueryAdapters.doGetFields(DataQueryAdapters.java:486)
at com.jaspersoft.studio.data.designer.AQueryDesignerContainer$1.run(AQueryDesignerContainer.java:49)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)

#4

Hello,

We have the same problem with jasper 7. Can you tell me a solution to use aggregate function ?

thanks

#5

The issue is that the Jaspersoft mongodb Connector (js-mongodb-datasource-2.0.9.jar) - the code is expecting the result data as inline results ('results' field). But MongoDB 3.6 results a cursor.
So it gives a 'No results exception' . This requires code change in the js-mongodb-datasource-2.0.9.jar and needs to be rebuilt. I could n't find the source of this component any where.

Due to this issue, Jasper report is almost unusable in all typical reports with MongoDB 3.6 and 4.0

Please help to resolve this issue.

#6

+1

This defect has crippled our implementation post the MongoDB upgrade. Is there any ETA for fix?
Let me know if you need any logs or inputs from the deployment to fix the issue.

#7

Hi Manoj - If this is impacting you then can you please vote to increase visibiltiy

#8
  • Reproducibility:N/A» Always

Hello,

I have getting same issue with MongoDB 3.6.4 aggregate query return No result found.

If any one have resolved issue please help us.

#9

I have been facing this same issue as well when we upgraded to mongo 3.6 - I can no longer run aggregation queries in my reports due to the results being returned as a cursor. Please update the mongo driver.

#10

Only MongoDB versions 3.0-3.4.1 are certified: https://community.jaspersoft.com/documentation/v710/tibco-jasperreports-...

#11
#12
#13
  • Priority:High» Immediate

Is there any update on this issue? The lack of 3.6-4 support is really hindering our product.

#14
#15

The Platform Support document for 7.2 indicates versions 3.0 - 4.0.x of MongoDB as "compatible" ("certified" in the commercial edition) : https://community.jaspersoft.com/documentation/v720/tibco-jasperreports-...

Did anyone verify if this is resolved in JRS 7.2.0 ?

#16

Hello, is there any updates on this issue ? i downloaded jaspersoft studio 6.9 but i still get the same issue.

#17

is there any updates with this issue ?

#18

It is not working with Mongodb 4.0 and Jasperserver 7.2

2019-08-14 14:52:46,132 ERROR SecureExceptionHandlerImpl,http-nio-8082-exec-8:116 - There was an error on the server. Try again or contact site administrators. (Error UID: b294fb43-0ce2-4c32-ae48-4da9b65a39dd)
2019-08-14 14:52:46,133 ERROR ErrorPageHandlerAction,http-nio-8082-exec-8:118 - Error UID b294fb43-0ce2-4c32-ae48-4da9b65a39dd
com.jaspersoft.jasperserver.api.JSException: Error filling report
Arguments:
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$FillResultListener.reportFillError(EngineServiceImpl.java:1344)
at net.sf.jasperreports.engine.fill.BaseFillHandle.notifyError(BaseFillHandle.java:228)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:150)
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$SynchronousExecutor.execute(EngineServiceImpl.java:964)
at net.sf.jasperreports.engine.fill.BaseFillHandle.startFill(BaseFillHandle.java:181)
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$AsynchronousReportFiller.fillReport(EngineServiceImpl.java:915)
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.fillReport(EngineServiceImpl.java:1846)
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportFill.runWithDataSource(EngineServiceImpl.java:1167)
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportFill.runReport(EngineServiceImpl.java:1108)
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportRunnable.run(EngineServiceImpl.java:986)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: net.sf.jasperreports.engine.JRException: The 'cursor' option is required, except for aggregate with the explain argument
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.runCommand(MongoDbQueryWrapper.java:207)
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.processQuery(MongoDbQueryWrapper.java:115)
at com.jaspersoft.mongodb.query.MongoDbQueryWrapper.<init>(MongoDbQueryWrapper.java:93)
at com.jaspersoft.mongodb.query.MongoDbQueryExecuter.createDatasource(MongoDbQueryExecuter.java:104)

#19

Probably *not* in JSS, but in JRS, you could try replacing two JAR's with their latest versions here:

https://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/3.10.2/mong...
https://jaspersoft.jfrog.io/jaspersoft/jaspersoft-repo/com/jaspersoft/co...

Feedback
randomness