Jasper Report using SUB REPORTS

I don’t know how to integrate my master jasper report and sub reports into the Bonitasoft task. I’ve set up my Jasper Documents as Groovy Multiple Script like this :

import org.bonitasoft.engine.bpm.document.DocumentValue;

[
new DocumentValue(“C:/ServiceAgreement.jrxml”),
new DocumentValue(“C:/ServiceAgreement1.jasper”),
new DocumentValue(“C:/ServiceAgreement2.jasper”),
new DocumentValue(“C:ServiceAgreement3.jasper”)
]

But I receive this error message from Bonitasoft error log:

**2016-08-09 09:43:45.917 -0700 org.bonitasoft.console.common.server.page.ResourceRenderer org.bonitasoft.console.common.server.page.ResourceRenderer getFileContent
WARNING: Cannot find the resource file D:\BonitaBPMCommunity-7.2.2\workspace\default\bonita_home\client\tenants\1\work\pages\custompage_ServiceAgreement\resources$data.session.user_name
2016-08-09 09:44:14.580 -0700 org.bonitasoft.engine.api.impl.transaction.flownode.ExecuteFlowNode org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl log
INFO: THREAD_ID=5058 | HOSTNAME=WebDeveloper | TENANT_ID=1 | The user <francisco.hassin> has executed the task [name = , display name = , id = <1220393>, parent process instance = <61089>, root process instance = <61089>, process definition = <5835167032689853950>] with task inputs: {noteContract=false, cashContract=false, sagreementInputContract={InitialServiceFee_string=0.0, InitialTax_string=0.0, ISOCompanyID=1, TermsOfAgreement=null, TechsLines=, NoEquipments=true, BillCity=Santa Ana, CheckNumber=null, AgreementID=1011, RecurringTax=0.0, newRequestProcessInstanceId=61089, equipmentsLines=, CVV2=null, LName=Cuervo, SourceID=3, BillCompanyName=Moore Invenstment Inc., CardFrequency=null, BillAddress=2154 Main St., Address2=, CardName=null, CardExpiration=null, MapPass=true, SignatureURL=none, LocationTypeID=4, SignaturePass=true, InitialDownPayment_string=0.0, persistenceVersion_string=0, BillFName=Moore, BillAddress2=, RecurringServiceFee=0.0, GIPass=true, BillFax=(714) 546-9873, BillTosID_string=1000, FName=Jose, SFPass=false, PaymentType=CREDIT CARD, Email=operations@panchovilla.com, newRequestProcessInstanceId_string=61089, InitialTax=0.0, BillTosID=1000, Phone=(909) 232-5698, DiagramURL=none, TheSameAddress=false, UserID=4513, persistenceVersion=0, BillEmail=operations@mooreenterprise.com, BranchID=1, BillLName=Joe, LocationID_string=null, persistenceId=13, BillPhone=(714) 546-9874, AllowRecurring=false, STPass=false, LocationID=null, CardType=VISA, RecurringTax_string=0.0, areasLines=, CardNumber=null, InitialDownPayment=0.0, RecurringServiceFee_string=0.0, Fax=(909) 232-5697, PONumber=null, NoAreas=true, AgreementPass=true, CreationDate=Tue Aug 09 09:43:45 PDT 2016, UserID_string=4513, InitialServiceFee=125.0, CompanyName=Pancho Villa, AgreementType=GP, ZipCode=92335, AllowOneTime=false, City=Fontana, Status=Pending, serviceTypesLines=[{ServiceFee=125.0, ServiceTypeID=1, SpecialInstructions=none, ServiceFrequencyID=4, TargetID=2, TreatingUnits=0}], BillStateID=CA, StateID=CA, persistenceId_string=13, Address=2587 Valley Blvd., EQPass=false, BillZipCode=92702, SAPass=false}, messageContract=none, ccContract=true, checkContract=false, initialProcessContract=false}
2016-08-09 09:44:14.839 -0700 org.bonitasoft.connectors.jasper.CreateReportFromDataBase org.bonitasoft.connectors.jasper.CreateReportFromDataBase initInputs
INFO: dbDriver org.h2.Driver
2016-08-09 09:44:14.839 -0700 org.bonitasoft.connectors.jasper.CreateReportFromDataBase org.bonitasoft.connectors.jasper.CreateReportFromDataBase initInputs
INFO: jdbcUrl jdbc:h2:tcp://localhost:9091/business_data.db;MVCC=TRUE;DB_CLOSE_ON_EXIT=FALSE;IGNORECASE=TRUE;
2016-08-09 09:44:14.839 -0700 org.bonitasoft.connectors.jasper.CreateReportFromDataBase org.bonitasoft.connectors.jasper.CreateReportFromDataBase initInputs
INFO: user sa
2016-08-09 09:44:14.839 -0700 org.bonitasoft.connectors.jasper.CreateReportFromDataBase org.bonitasoft.connectors.jasper.CreateReportFromDataBase initInputs
INFO: password ******
2016-08-09 09:44:14.839 -0700 org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl log
SEVERE: THREAD_ID=3947 | HOSTNAME=WebDeveloper | TENANT_ID=1 | The work [ExecuteConnectorOfActivity: flowNodeInstanceId = 1220396, connectorDefinitionName = myAgreementReport] failed. The failure will be handled.
2016-08-09 09:44:14.852 -0700 org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl log
SEVERE: THREAD_ID=3947 | HOSTNAME=WebDeveloper | TENANT_ID=1 | org.bonitasoft.engine.core.connector.exception.SConnectorException : “PROCESS_DEFINITION_ID=5835167032689853950 | PROCESS_NAME=New Service Agreement Request | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=61089 | ROOT_PROCESS_INSTANCE_ID=61089 | FLOW_NODE_DEFINITION_ID=7964008443345138615 | FLOW_NODE_INSTANCE_ID=1220396 | FLOW_NODE_NAME=Generate Report | CONNECTOR_IMPLEMENTATION_CLASS_NAME=myAgreementReport | CONNECTOR_INSTANCE_ID=380054 | org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String”
org.bonitasoft.engine.core.connector.exception.SConnectorException: PROCESS_DEFINITION_ID=5835167032689853950 | PROCESS_NAME=New Service Agreement Request | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=61089 | ROOT_PROCESS_INSTANCE_ID=61089 | FLOW_NODE_DEFINITION_ID=7964008443345138615 | FLOW_NODE_INSTANCE_ID=1220396 | FLOW_NODE_NAME=Generate Report | CONNECTOR_IMPLEMENTATION_CLASS_NAME=myAgreementReport | CONNECTOR_INSTANCE_ID=380054 | org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String
at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeConnectorInClassloader(ConnectorServiceImpl.java:274)
at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeConnector(ConnectorServiceImpl.java:147)
at org.bonitasoft.engine.connector.ConnectorServiceDecorator.executeConnector(ConnectorServiceDecorator.java:114)
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.work(ExecuteConnectorWork.java:138)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
at org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork.work(FailureHandlingBonitaWork.java:66)
at org.bonitasoft.engine.work.BonitaWork.run(BonitaWork.java:56)
at org.bonitasoft.engine.work.SequenceRunnableExecutor.innerRun(SequenceRunnableExecutor.java:47)
at org.bonitasoft.engine.work.BonitaRunnable.run(BonitaRunnable.java:35)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String
at org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl.execute(ConnectorExecutorImpl.java:125)
at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeConnectorInClassloader(ConnectorServiceImpl.java:268)
… 14 more
Caused by: java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl.getValue(ConnectorExecutorImpl.java:149)
at org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl.execute(ConnectorExecutorImpl.java:122)
… 15 more
Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String
at org.bonitasoft.connectors.jasper.CreateReportFromDataBase.initInputs(CreateReportFromDataBase.java:124)
at org.bonitasoft.connectors.jasper.CreateReportFromDataBase.validateInputParameters(CreateReportFromDataBase.java:151)
at org.bonitasoft.engine.core.connector.impl.SConnectorAdapter.validate(SConnectorAdapter.java:64)
at org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl$ExecuteConnectorCallable.call(ConnectorExecutorImpl.java:203)
at org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl$ExecuteConnectorCallable.call(ConnectorExecutorImpl.java:176)
at java.util.concurrent.FutureTask.run(Unknown Source)
… 3 more
**

If someone has already found the solution for this type of error, I would be very grateful for any help. Thank in advance.

Your problem is here…

org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String"

Are you using the right data in the right way?

Bonitasoft only knows about jasper report, not sub reports, maybe this is the issue?

Regards
Sean

Ps if this answers your question please mark as resolved.

Thanks Sean for your answer. Let me tell you something : when I put a Jasper report without sub reports, it works very well, I have no problems, unfortunately, I need the Jasper sub reports but I think that Bonitasoft doesn’t work with multiple reports. I’ve tried to set up multiple documents using a Groovy script :

import org.bonitasoft.engine.bpm.document.DocumentValue;

[
new DocumentValue(“C:/ServiceAgreement.jrxml”),
new DocumentValue(“C:/ServiceAgreement1.jasper”),
new DocumentValue(“C:/ServiceAgreement2.jasper”),
new DocumentValue(“C:/ServiceAgreement3.jasper”)
]

This snippet code I got it from Bonitasoft tutorial :

[Bonitasoft Tutorial]
[Bonitasoft Tutorial]: http://documentation.bonitasoft.com/documents-0

Bottom Line : Have you ever worked with Jasper Sub reports and Bonitasoft. Let me know if anyone else knows how to do it. I would really appreciate. Thanks Sean again.

I make a new connector, i use the same configuration in the bonita connector and add an extra option called subreport, i send the names of the subreports documents, this documents are jrxml documents in the bonita bpm lane, so i convert this jrxml to .jasper in the fly and then i inject this reports to the parameters list from the parent report.

I know your question is old, but did you happen to be able to solve your sub report question? I’m having the same problem you mentioned

Really? You’re questioning if I’ve used Jasper (removed the word sub) Reports and Bonitasoft…

I could say go and learn it yourself, but this is community and you’ve asked a question and I’m trying to help. Be gracious.

How would I know if anyone else has done this? I don’t read everyone’s posts…if others want to chip in then they will but I do this on my time and at my expense. There is an old saying Don’t slap the hand that feeds you, maybe you could look it up.

As it is - here is my two pennies worth.

First thing is for every Bonitasoft document you can ONLY have one document, that is why it works, the other method you are trying will never work.

Second I don’t think you know Jasper as well as you think you do if you think sub-reports are separate reports and should be combined the way you’re trying to.

Your sub-reports are part of your main report and must be INCLUDED into your main report. That way you get one report.

When you generate the main, it will automatically generate the sub-reports and include them into the main document, which you then use as a single report.

I think your main report and sub-reports are not linked correctly and that is why you are trying to do it the way you are doing it, and it’s wrong.

Using a simple Google Search jasper sub-reports I found lots of hits. Here are some you might want to look at.

http://community.jaspersoft.com/wiki/subreports
http://stackoverflow.com/questions/9785451/generate-jasper-report-with-subreport-from-java

regards
Seán

PS: If this reply answers your question, please mark as resolved.

PPS: Please don’t submit an Answer as a comment - If you look at the page correctly - you can comment on a comment or an Answer - Answer is for the actual Answer…

Could you show me how you made this connector? Or maybe you can show me an example of how you did it in practice?