It's all about the answers!

Ask a question

Can I use jar contents in a BIRT report running on the Jazz server without creating a plugin?


Andrew Stevens (1482229) | asked Jul 07 '15, 8:02 a.m.
edited Jul 07 '15, 8:03 a.m.
Hi,

I'm including a number of custom attributes in a custom work item report, and was wanting to use the Commons Collections class MultiKeyMap for simplicity - I can cache the values I need with a dataset containing only stringWorkItemCustomAttributes.put(row["WI_ID"], row["STRING_KEY"], row["STRING_VAL"]) in the onFetch script, and use them in my main dataset with calculated columns of the form stringWorkItemCustomAttributes.get(row["WI_ID"], "myAttributeKey"), and no messing around with separate Maps for each attribute or Maps of Maps to store the sets of attributes for each work item.

At first I got an error when previewing the report in RAD, but I fixed that by adding commons-collections-3.2.1.jar to the Jar Files list in the report's Properties Resources tab.  So everything works perfectly now when I preview it locally.

However, when I upload the report to the server and try to run it there, I get an error message
There are errors evaluating script "importPackage(Packages.org.apache.commons.collections.map);
stringWorkItemCustomAttributes = MultiKeyMap.decorate(new HashedMap());
":
ReferenceError: "MultiKeyMap" is not defined. (/report/method[@name="initialize"]#5)
which I figure is because the report isn't finding the commons collection jar in the classpath when it runs on the server.  When uploading the report to the server I did include the jar in the Files list at the bottom of the dialog, but it seems that this isn't enough to let the report use its contents.  And there's no separate "Jar Files" list when creating the new Report Resource.

Other things I've found in the forums and wiki, about using java code from reports, all talk about creating a plugin and update site and adding that to the server installation.  But our RTC server's a central resource that's used globally, and the chances of me (or any single project area admin) getting anything installed server-wide are practically zero.  So is there any other way to allow the report to use the jar?  Or do I need to rewrite the report to use only classes in the standard java runtime, and forget about any useful 3rd party libraries?


Andy.

Accepted answer


permanent link
Rafik Jaouani (4.9k16) | answered Jul 07 '15, 9:01 a.m.
JAZZ DEVELOPER
Hi Andrew, RTC does not support attaching a jar to a BIRT report.
Andrew Stevens selected this answer as the correct answer

Comments
Andrew Stevens commented Jul 07 '15, 10:27 a.m.

What about library (.rptlibrary) resources?  Should I be able to use those with reports running on a Jazz server?  And would they need attaching when uploading the .rptreport, or are they just a design-time convenience?
I've seen a few strange errors and/or things not always working when adding data sources and data sets from a shared library into a report, which went away when I deleted the linked objects and used copy/paste from the library instead (reinstating table bindings etc.)
Or should I expect the shared ones to work, and persevere?

One other answer



permanent link
Rafik Jaouani (4.9k16) | answered Jul 07 '15, 11:08 a.m.
JAZZ DEVELOPER
You need to attach the rptlibrary as a resource to the report resource when deploying it. The out of box share a library named shared rptlibrary that contains common styles. I have not tried putting data sets in libraries but I do not see why it would not work.

Comments
Andrew Stevens commented Jul 09 '15, 12:50 p.m.

What about report parameters?

I don't know if it's due to having my (cascading group) parameter linked from the Shared.rptlibrary, or the data sets it's based on, or their data sources, but when I run the report on the server it throws up an error "TypeError: 'parameters.length' is null or not an object".  Works perfectly okay within the IDE...

Your answer


Register or to post your answer.