问题
I recently changed my MongoDB database version from 3.4 to 4.0 and I started getting this error:
Even though I added the cursor option: cursor :{} I get the error no result Found
{
runCommand: {
aggregate : 'Org',
pipeline : [
{
$project : {
Miss_Attr.categorie:1,
Miss_Attr.texte:1
}
},
{ $unwind : '$Miss_Attr'}
]
}}
Error:
net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: The 'cursor' option is required, except for aggregate with the explain argument at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:550) at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$18(ReportController.java:525) at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:443) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: The 'cursor' option is required, except for aggregate with the explain argument at net.sf.jasperreports.components.list.VerticalFillList.prepare(VerticalFillList.java:150) at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:152) at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:542) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:453) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:428) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2585) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:813) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:264) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:110) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615) at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:135) 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.(MongoDbQueryWrapper.java:93) at com.jaspersoft.mongodb.query.MongoDbQueryExecuter.createDatasource(MongoDbQueryExecuter.java:104) at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1257) at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:726) at net.sf.jasperreports.components.list.FillDatasetRun.start(FillDatasetRun.java:166) at net.sf.jasperreports.components.list.VerticalFillList.prepare(VerticalFillList.java:102) ... 11 more
回答1:
This article on JasperSoft forums fixes this:
https://community.jaspersoft.com/jasperreports-server/issues/10886
Outlined steps (on JasperSoft Server 7.2.0)
- Download these two JAR files:
Mongo Java Driver
JS MongoDB driver
Remove the older variants of these files from {jasperserver_root}\apache-tomcat\webapps\jasperserver\WEB-INF\lib
Place files from step 1 into {jasperserver_root}\apache-tomcat\webapps\jasperserver\WEB-INF\lib
Reboot reporting server
For JasperSoft Studio, this is fixed in version 7.5.0. Also, it might be that this is fixed in JasperSoft Server 7.5.0, however, my current deployment is 7.2.0
来源:https://stackoverflow.com/questions/57123855/mongodb-4-0-jrexception-the-cursor-option-is-required-except-for-aggregate-w