Jump to content
We've recently updated our Privacy Statement, available here ×

Preview reports using xpath2 and remote XML datasource in Jaspersoft Studio 6.6?


bigs18

Recommended Posts

Hi all. Teodor, I'm hoping you will chime in, as you seem to have provided the most helpful guidance to others who have been working on this issue or similar issues.

I think I have read all of the relevant posts and tried everything suggested, but I still cannot get Jaspersoft Studio to successfully preview a .jrxml report with query language xpath2 and a remote XML datasource. If I change the query language to XPath, simple reports will work, but the more complex ones with multiple datasets do not fill properly. And then I have to change the query language back to xpath2 when I upload the report code to my target web application anyway, as it does not work correctly in the web app as XPath. 

These reports work perfectly in iReport but obviously that is old software and I would prefer to use JSS.

I have added jasperreports-extensions-3.5.3.jar as an External JAR to the Java Build Path of my JSS project file as suggested  Then I found the following post which suggested that a jasperreports.properties file was required with the property definition as shown below. Where in the directory structure of Jaspersoft Studio should that go? I'm on Windows 10 and installed with default configuration. I have also tried creating this property inside the report itself but that did not help.

Please help, I am desperate to get this working! Thanks,

Bigs

From https://community.jaspersoft.com/questions/542129/no-query-executer-factory-registered-xpath2-language:

"What you missed is something I missed too and only became apparent when testing the thing myself.

The extensions JAR present in iReport is not packaged as a true JR extension because it does not contain a jasperreports_extension.properties file in its root package.

So although it brings to the classpath the required classes, it does not register them with JR.

The solution was to register the xpath2 language with a line in the jasperreports.properties file that sits in the root package of your application classpath. If you don't have one, you should create it and add this line to it:

net.sf.jasperreports.query.executer.factory.xpath2=com.jaspersoft.jrx.query.JRXPathQueryExecuterFactory"

 

Link to comment
Share on other sites

  • 4 weeks later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

The xpath2 is no longer supported. There are newer ways to get XML data from a remote location and query it using XPath.

You need to explain where do you get your data from (HTTP, basic authentication, etc) and we'll try to direct you to achieve what you want with current functionality.

Have you looked at the /demo/samples/httpdataadapter sample in the recent JR Lib releases?

It demonstrates how to run a report against XML data coming from a report URL through HTTP.

I hope this helps.
Teodor

Link to comment
Share on other sites

Hi Teodor-

Thanks for the response. The app is called Flex Rental Solutions. I am an external consultant / developer so I'm not sure exactly how the Jaspersoft software is configured and the server-side configuration will not be modified to address this issue. More information can be found here if you're interested. I will explain how I interact with it.

In iReport, I create a remote XML datasource using a URL like this:

http://bigs.flexrentalsolutions.com/xml-data/data-producer-financial-document?PROJECT_ELEMENT_ID=b5743f20-2d78-11e8-83e7-0023aeed7fe8

That's the only information I input for the datasource - when I first generate a preview in iReport or open the Report Query window, it asks for my user/password and then remembers it until iReport is closed.

If I access that URL in browser, it gives me an XML data tree - snippet shown below.

<report>    <corporateIdentityName>Photon Emitter</corporateIdentityName>    <corporateIdentity>        <baseCurrencyId>1e40d0d0-1e3e-11e8-9c5e-0023aeed7fe8</baseCurrencyId>        <baseCurrencyName>Australian Dollar</baseCurrencyName>        <companyName>Photon Emitter</companyName>        <defaultTermsAndConditions>...</defaultTermsAndConditions>        <documentAddressStyle>right-of-logo</documentAddressStyle>        <documentLogoId>694eb3c0-3735-11e8-92c0-0023aeed7fe8</documentLogoId>        <dunsNumber>info@photonemitter.com.au</dunsNumber>        <employerIdentificationNumber/>        <record>            <lineItemGroup/>            <lineItemGroupFooter/>            <groupTotalBeforeDiscount/>            <groupDiscount/>            <isGroupDiscount/>            <groupDiscountPct/>            <groupTotal/>            <groupFacilityName/>            <partNumber/>            <quantity>1</quantity>            <description>Flex - Consultation</description>[/code]

When iReport connects to that remote data producer, there are also a handul of parameters which are injected at runtime and allow the preview to be generated. 

I can create a data producer using a local XML file that previews perfectly in iReport but it doesn't work properly in JSS. But the whole point of this exercise is to be able to see live previews using the data on the server so using a local XML file isn't very helpful anyway.

I have looked over the httpdataadapter info but I'm not sure if it would make a difference? I think the issue is that the reports need to have the query language defined as xpath2. If i change the dataset query language to XPath, it works in JSS. But it then has to be changed back to xpath2 when uploaded to run properly on the server.

I am aware that xpath2 has not been supported for a while now, but in the forum post I referenced in my original post and in others like this one, you reference adding an xpath2 query executor to the classpath. Is it possible to add jasperreports-extensions-3.5.3.jar to the JSS classpath to include xpath2 query executor? Would that allow JSS to generate the previews correctly? If so, how exactly would I do that?

Thank you

Bigs

 

 

Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...