Jasper Server 7.1.0. - Json data source - Teiid  Virtual Data Source Query Service

0

Hello,I've been trying to solve this problem for days now, and I'm running out of ideas.

com.jaspersoft.jasperserver.api.common.virtualdatasourcequery.VirtualDataSourceException: Teiid  Virtual Data Source Query Service - unsupported data source: mydata

On my local machine (everything works)

I have a basic json file "mydata.json"

{"Data": {"Param1" :"Hello"}}

I have a data adapter pointing to it.

I have a very simple report that display the "Param1" field.

<queryString language="json">
    <![CDATA[Data]]>
</queryString>
    [...]
<field name="Param1" class="java.lang.String">
    <property name="net.sf.jasperreports.json.field.expression" value="Param1"/>
    <fieldDescription><![CDATA[Param1]]></fieldDescription>
</field>
    [...]
<textField>
    <reportElement x="0" y="0" width="100" height="30" uuid="8c01d597-ab0f-4282-9ecd-2c5f76a7ccb4"/>
    <textFieldExpression><![CDATA[$F{Param1}]]></textFieldExpression>
</textField>


The report works fine from Jasper Studio.

On the server (Product Version: 7.1.0 Build: 20180504_1307)

I have a folder named /jasondata. The server has access to it.

I have a JSON data source named "mydata".

I publish my report to the server and use this data source.

When I try to run the report, I have this error:

Error Message
There was an error on the server. Try again or contact site administrators. (Error UID: b2327bce-7cd9-4784-ba36-eb3415023c26)

The entire error message, from jasperserver.log

2019-03-28 12:16:54,089 DEBUG VirtualDataSourceQueryService,pool-6-thread-6:253 - ********* getConnectionFactory [BEGIN] *********************
2019-03-28 12:16:54,092 DEBUG VirtualDataSourceQueryService,pool-6-thread-6:253 - Add sub data source - -407034623
2019-03-28 12:16:54,107 ERROR ErrorPageHandlerAction,http-nio-8080-exec-10:115 - Error UID a8f718ab-73e5-4d22-934e-acb7b9f06206
com.jaspersoft.jasperserver.api.JSExceptionWrapper:
com.jaspersoft.jasperserver.api.common.virtualdatasourcequery.VirtualDataSourceException: Teiid  Virtual Data Source Query Service - unsupported data source: mydata
        at com.jaspersoft.jasperserver.api.engine.common.virtualdatasourcequery.impl.TeiidVirtualDataSourceQueryServiceImpl.getDataSource(TeiidVirtualDataSourceQueryServiceImpl.java:739)
        at com.jaspersoft.jasperserver.api.engine.common.virtualdatasourcequery.impl.TeiidVirtualDataSourceQueryServiceImpl.getConnectionFactory(TeiidVirtualDataSourceQueryServiceImpl.java:717)
        at com.jaspersoft.jasperserver.api.engine.common.virtualdatasourcequery.impl.TeiidVirtualDataSourceQueryServiceImpl.addSubDataSource(TeiidVirtualDataSourceQueryServiceImpl.java:481)
        at com.jaspersoft.jasperserver.api.engine.common.virtualdatasourcequery.impl.AbstractVirtualDataSourceQueryServiceImpl.addOrMarkSubDataSource(AbstractVirtualDataSourceQueryServiceImpl.java:156)
        at com.jaspersoft.jasperserver.api.engine.common.virtualdatasourcequery.impl.AbstractVirtualDataSourceQueryServiceImpl.getConnectionFactory(AbstractVirtualDataSourceQueryServiceImpl.java:80)
        at com.jaspersoft.jasperserver.api.engine.common.virtualdatasourcequery.VirtualDataSourceHandler.getSqlDataSource(VirtualDataSourceHandler.java:148)
        at com.jaspersoft.jasperserver.api.engine.jasperreports.util.CustomJDBCReportDataSourceServiceFactory.createService(CustomJDBCReportDataSourceServiceFactory.java:80)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91)
        at com.jaspersoft.jasperserver.api.metadata.user.service.impl.ProfileAttributesResolverAspect.resolveDataSourceAttributes(ProfileAttributesResolverAspect.java:47)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at com.sun.proxy.$Proxy54.createService(Unknown Source)
        at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.CustomReportDataSourceServiceFactory.createService(CustomReportDataSourceServiceFactory.java:103)
        at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.CustomReportDataSourceServiceFactory$$FastClassBySpringCGLIB$$597fa680.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:701)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:91)
        at com.jaspersoft.jasperserver.api.metadata.user.service.impl.ProfileAttributesResolverAspect.resolveDataSourceAttributes(ProfileAttributesResolverAspect.java:47)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:633)
        at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.CustomReportDataSourceServiceFactory$$EnhancerBySpringCGLIB$$8bce4df3.createService(<generated>)
        at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.CustomReportDataSourceServiceFactory$$FastClassBySpringCGLIB$$597fa680.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:701)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:132)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:120)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:633)
        at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.CustomReportDataSourceServiceFactory$$EnhancerBySpringCGLIB$$a0c54208.createService(<generated>)
        at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.createDataSourceService(EngineServiceImpl.java:2017)
        at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.fillReport(EngineServiceImpl.java:1822)
        at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportFill.runWithDataSource(EngineServiceImpl.java:1159)
        at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportFill.runReport(EngineServiceImpl.java:1088)
        at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportRunnable.run(EngineServiceImpl.java:983)
        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)


I have no clue, not even where to start.

For instance, I don't understand why my Json data source is a "Virtual Data Source"...

Any help would be greatly appreciated!

Did someone successfuly used a JSON file that is local to the server? Or even uploaded to the server, by using "repo:/{path to file}"?

Thanks,

Liviu Vasile

liviu.vasile's picture
Joined: Jan 9 2017 - 1:23am
Last seen: 4 weeks 1 day ago

1 Answer:

1

New idea

After writing the post I got an idea: what if my data adapter created on server is of wrong type? (I know, the interface says clearly "JSON Data Source"... but still).

So I compared the xml for my local data adapter:

<?xml version="1.0" encoding="UTF-8" ?>
<jsonDataAdapter class="net.sf.jasperreports.data.json.JsonDataAdapterImpl">
    <name>mydata</name>
    <dataFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="repositoryDataLocation">
        <location>C:\jsondata\mydata.json</location>
    </dataFile>
    <language>json</language>
    <useConnection>true</useConnection>
    <timeZone xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://java.sun.com" xsi:type="java:java.lang.String">Europe/Paris</timeZone>
    <locale xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://java.sun.com" xsi:type="java:java.lang.String">en_US</locale>
    <selectExpression/>
</jsonDataAdapter>

With the one on the server:

<?xml version="1.0" encoding="UTF-8"?>
<customDataSource exportedWithPermissions="true">
    <folder>/datasources</folder>
    <name>mydata</name>
    <version>0</version>
    <label>mydata</label>
    <creationDate>2019-03-28T12:10:10.000Z</creationDate>
    <updateDate>2019-03-28T12:10:10.000Z</updateDate>
    <serviceClass>com.jaspersoft.jasperserver.api.metadata.jasperreports.service.ReportDataAdapterService</serviceClass>
    <property>
        <key>fileName</key>
        <value>/jsondata/mydata.json</value>
    </property>
    <property>
        <key>language</key>
        <value>JSON</value>
    </property>
    <property>
        <key>_cds_name</key>
        <value>jsonDataSource2</value>
    </property>
    <property>
        <key>selectExpression</key>
        <value>&lt;![CDATA[Data]]&gt;</value>
    </property>
</customDataSource>

So we can see that the server created a "custom data source".

Solution (workaround)

I edited my local data adapter file to this (I just changed the "location" field)

<?xml version="1.0" encoding="UTF-8" ?>
<jsonDataAdapter class="net.sf.jasperreports.data.json.JsonDataAdapterImpl">
    <name>mydata</name>
    <dataFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="repositoryDataLocation">
<location>/jsondata/mydata.json</location>
</dataFile>
    <language>json</language>
    <useConnection>true</useConnection>
    <timeZone xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://java.sun.com" xsi:type="java:java.lang.String">Europe/Paris</timeZone>
    <locale xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://java.sun.com" xsi:type="java:java.lang.String">en_US</locale>
    <selectExpression/>
</jsonDataAdapter>

Then I uploaded it via the server's interface as a simple XML file (see this wiki).Then I added a property to my report:

<property name="net.sf.jasperreports.data.adapter" value="repo:/datasources/jsondata.xml"/>

Then I uploaded the report.

Now it works!

Real solution

Still waiting for one. That is, creating a JSON data source that works via interface.

Best regards,

Liviu Vasile

liviu.vasile's picture
Joined: Jan 9 2017 - 1:23am
Last seen: 4 weeks 1 day ago
Feedback