1 2 Previous Next 17 Replies Latest reply on Aug 26, 2015 10:44 AM by shawkins

    Problem with Tranformation SQL

    lvsmix

      Hi

      I cant generate transformation in my view model.

       

      my transformation sql is

       

      BEGIN

        DECLARE STRING VARIABLES.qp = QUERYSTRING((('http://localhost:8080/SeguridadAD/rest/RESTEasyLdap/getPhoto' || '/') || WsViewModel.getImageWs.logonUser));

        SELECT A.data AS data, A.codError AS codError FROM (EXEC WsModel.invokeHttp(action => 'GET', endpoint => VARIABLES.qp, stream => TRUE)) AS f, XMLTABLE('/response' PASSING JSONTOXML('response', f.result) COLUMNS data string PATH 'data/text()', codError string PATH 'codError/text()') AS A;

      END

       

      and editor send me this message:

       

      ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: 1

       

      I cant understand What is the problem in the query. Aparently the error is in QUERYSTRING((('http://localhost:8080/SeguridadAD/rest/RESTEasyLdap/getPhoto' || '/') || WsViewModel.getImageWs.logonUser))  but I cant see the problem.

       

      Help me, please

       

      Thanks you

        • 1. Re: Problem with Tranformation SQL
          tejones

          Hi Luis,

           

          It looks like you are hitting this: https://issues.jboss.org/browse/TEIIDDES-2546

           

          What version of Designer and Teiid are you using?

           

          Thanks,

          Ted

          • 2. Re: Problem with Tranformation SQL
            rareddy

            For what you are doing you do not really need a QUERYSTRING function, can you try like

             

            BEGIN
              DECLARE STRING VARIABLES.qp = 'http://localhost:8080/SeguridadAD/rest/RESTEasyLdap/getPhoto' || '/' || WsViewModel.getImageWs.logonUser;
              SELECT A.data AS data, A.codError AS codError FROM (EXEC WsModel.invokeHttp(action => 'GET', endpoint => VARIABLES.qp, stream => TRUE)) AS f, XMLTABLE('/response' PASSING JSONTOXML('response', f.result) COLUMNS data string PATH 'data/text()', codError string PATH 'codError/text()') AS A;
            END
            

             

            Ramesh..

            • 3. Re: Problem with Tranformation SQL
              lvsmix

              Hi Ted Jones

               

              I am using Teiid Designer 9.1.0 - Beta1 and Teiid Runtime 9.0. 

               

              Hi Ramesh

              I get the same error.

               

              Luis

              • 4. Re: Problem with Tranformation SQL
                lvsmix

                Teiid Runtime 8.9.0

                • 5. Re: Problem with Tranformation SQL
                  shawkins

                  Please show the entire stacktrace to confirm if you are hitting the existing issue that Ted is referencing.

                  • 6. Re: Problem with Tranformation SQL
                    tejones

                    Luis.. I have not been able to duplicate this error.

                    I have been unable to reproduce this. Can you please verify your saxon version?

                     

                    It should be: org.jboss.tools.locus.sf.saxon_9.5.1.v20150427-1451.jar for TD 9.1.0.Beta and NOT org.jboss.tools.locus.sf.saxon_9.2.1.5j-Final-v20131024-0922-B58.jar.

                     

                    This was changed for 9.1.0.

                     

                    Thanks,

                    Ted

                    • 7. Re: Problem with Tranformation SQL
                      daan-isaac

                      Hello Ted,

                       

                      It seems I have the same problem. I use Teiid Designer 9.1.0 with Teiid Runtime 8.7.1 and a similar transformation in the view model gives an error in the editor:

                       

                      ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: 1

                       

                      The list of plugins in JBDS (Help -> Install Details -> Plugins) shows the org.jboss.tools.locus.sf.saxon_9.5.1.v20150427-1451.jar version, and not the saxon_9.2.1.5. However, the plugin folder of the studio (<install_folder>\jbdevstudio\studio\plugins) contains both org.jboss.tools.locus.sf.saxon_9.5.1.v20150427-1451.jar and org.jboss.tools.locus.sf.saxon_9.2.1.5j-Final-v20131024-0922-B58.jar.

                       

                      How can I be sure that the correct saxon version is used?

                       

                      Thanks,

                      Daan

                      • 8. Re: Problem with Tranformation SQL
                        lvsmix

                        Hello Daan:

                         

                        If you try to install Teiid Runtime 8.9.0 and repeat test again?

                        • 9. Re: Problem with Tranformation SQL
                          tejones

                          Hi Daan,

                           

                          Have you started with a clean/fresh install of JBDS and then installed Teiid Designer 9.1? It looks like there may be another TD install with the older saxon version and that may be causing an issue. I understand you are using product so upgrading Teiid is not a likely option, correct?

                           

                          Thanks,

                          Ted

                          • 10. Re: Problem with Tranformation SQL
                            daan-isaac

                            Hi Ted,

                             

                            I started with a clean install of JBDS and then installed Teiid Designer 9.1. The list of plugins in JBDS shows that it indeed uses org.jboss.tools.locus.sf.saxon 9.5.1.v20150427-1451. The plugin folder of the studio (<install_folder>\jbdevstudio\studio\plugins) now only contains the corresponding jar.

                             

                            The StringIndexOutOfBoundsException no longer occurs, but instead an IllegalArgumentException is thrown when entering the following transformation:

                            BEGIN

                                DECLARE STRING VARIABLES.qp = 'http://www.telize.com/geoip';

                                SELECT A.country AS country, A.timezone AS timezone FROM (EXEC SourceModel.invokeHttp(action => 'GET', endpoint => VARIABLES.qp, stream => TRUE)) AS f, XMLTABLE('/response' PASSING JSONTOXML('response', f.result) COLUMNS country string PATH 'country/text()', timezone string PATH 'timezone/text()') AS A;

                            END

                             

                            I am indeed using the product so if this can be solved within the product that would be great. Otherwise I will consider moving to the community version.

                             

                            Thanks,

                            Daan

                            • 11. Re: Problem with Tranformation SQL
                              tejones

                              Hi Daan,

                               

                              Can you please post that last stack trace? Also, what OS are you running Designer on? There was an issue with Designer 9.1 on Windows uncovered and fixed recently that may be related: [TEIIDDES-2585] Teiid designer giving String index out of range - JBoss Issue Tracker.

                               

                              Thanks,

                              Ted

                              • 12. Re: Problem with Tranformation SQL
                                daan-isaac

                                Hi Ted,

                                 

                                The error is present when using Teiid Designer 9.1.0.Final. When upgrading to Teiid Designer 9.1.1.Nightly, I no longer get that error. The following error is shown in the Transformation Editor:

                                ERROR: org.teiid.runtime.client.TeiidClientException: TEIID30145 Unable to convert procedural parameter SourceModel.invokeHttp.stream of type string to expected type boolean

                                 

                                when this transformation is used:

                                ------------------

                                BEGIN

                                  DECLARE STRING VARIABLES.qp = 'http://www.telize.com/geoip';

                                  SELECT A.country AS country, A.timezone AS timezone FROM (EXEC SourceModel.invokeHttp(action => 'GET', endpoint => VARIABLES.qp, stream => 'TRUE')) AS f, XMLTABLE('/response' PASSING JSONTOXML('response', f.result) COLUMNS country string PATH 'country/text()', timezone string PATH 'timezone/text()') AS A;

                                END

                                ------------------

                                There is no further stack trace related to this error.

                                 

                                 

                                The Designer runs on Windows 7 for me. I also encountered TEIIDDES-2585, but that error pops up before the error in the Transformation Editor. In particular, when I have an empty Teiid Model Project, I start the Import wizard and select Web Service Source >> Source and View (REST), it creates four 'String index out of range:1' exceptions. Each of the stacktraces is related to the error as in TEIIDDES-2585 and very similar. One of them is as follows:

                                 

                                java.lang.StringIndexOutOfBoundsException: String index out of range: 1

                                  at java.lang.String.charAt(String.java:658)

                                  at java.util.regex.Matcher.appendReplacement(Matcher.java:762)

                                  at java.util.regex.Matcher.replaceAll(Matcher.java:906)

                                  at java.lang.String.replaceAll(String.java:2162)

                                  at org.teiid.query.metadata.SystemMetadata.<init>(SystemMetadata.java:90)

                                  at org.teiid.query.metadata.SystemMetadata.getInstance(SystemMetadata.java:66)

                                  at org.teiid.query.function.metadata.FunctionMetadataValidator.validateFunctionMethods(FunctionMetadataValidator.java:72)

                                  at org.teiid.query.function.SystemFunctionManager.getSystemFunctions(SystemFunctionManager.java:77)

                                  at org.teiid.runtime.client.query.QueryService.createFunctionLibrary(QueryService.java:137)

                                  at org.teiid.designer.udf.UdfManager.getSystemFunctionLibrary(UdfManager.java:372)

                                  at org.teiid.query.ui.sqleditor.sql.SqlSyntax.init(SqlSyntax.java:93)

                                  at org.teiid.query.ui.sqleditor.sql.SqlSyntax.<init>(SqlSyntax.java:61)

                                  at org.teiid.query.ui.sqleditor.sql.SqlCompletionProcessor.<init>(SqlCompletionProcessor.java:39)

                                  at org.teiid.designer.transformation.ui.editors.sqleditor.SqlSourceViewerConfiguration.getContentAssistant(SqlSourceViewerConfiguration.java:67)

                                  at org.teiid.designer.transformation.ui.editors.sqleditor.SqlTextViewer.<init>(SqlTextViewer.java:84)

                                  at org.teiid.designer.transformation.ui.wizards.xmlfile.TeiidXmlImportXmlConfigurationPage.createXmlTableSqlGroup(TeiidXmlImportXmlConfigurationPage.java:203)

                                  at org.teiid.designer.transformation.ui.wizards.xmlfile.TeiidXmlImportXmlConfigurationPage.createControl(TeiidXmlImportXmlConfigurationPage.java:99)

                                  at org.teiid.designer.ui.common.wizard.AbstractWizard.createPageControls(AbstractWizard.java:153)

                                  at org.teiid.designer.ui.common.wizard.AbstractWizard.createPageControls(AbstractWizard.java:138)

                                  at org.teiid.designer.transformation.ui.wizards.file.TeiidMetadataImportWizard.createPageControls(TeiidMetadataImportWizard.java:168)

                                  at org.eclipse.jface.wizard.WizardDialog.createPageControls(WizardDialog.java:759)

                                  at org.eclipse.jface.wizard.WizardDialog.setWizard(WizardDialog.java:1210)

                                  at org.eclipse.jface.wizard.WizardDialog.updateForPage(WizardDialog.java:1271)

                                  at org.eclipse.jface.wizard.WizardDialog.access$4(WizardDialog.java:1268)

                                  at org.eclipse.jface.wizard.WizardDialog$8.run(WizardDialog.java:1257)

                                  at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)

                                  at org.eclipse.jface.wizard.WizardDialog.showPage(WizardDialog.java:1254)

                                  at org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDialog.java:942)

                                  at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:434)

                                  at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:619)

                                  at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)

                                  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

                                  at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)

                                  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)

                                  at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)

                                  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)

                                  at org.eclipse.jface.window.Window.runEventLoop(Window.java:832)

                                  at org.eclipse.jface.window.Window.open(Window.java:808)

                                  at org.eclipse.ui.internal.handlers.WizardHandler$Import.executeHandler(WizardHandler.java:158)

                                  at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:290)

                                  at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294)

                                  at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                                  at java.lang.reflect.Method.invoke(Method.java:606)

                                  at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)

                                  at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:247)

                                  at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:229)

                                  at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)

                                  at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:149)

                                  at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)

                                  at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)

                                  at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)

                                  at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:343)

                                  at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:159)

                                  at org.eclipse.ui.internal.actions.CommandAction.run(CommandAction.java:174)

                                  at org.eclipse.ui.actions.ImportResourcesAction.run(ImportResourcesAction.java:99)

                                  at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:170)

                                  at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)

                                  at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)

                                  at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)

                                  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

                                  at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)

                                  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)

                                  at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)

                                  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)

                                  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)

                                  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

                                  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)

                                  at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)

                                  at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)

                                  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

                                  at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)

                                  at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)

                                  at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)

                                  at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)

                                  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)

                                  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)

                                  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)

                                  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                                  at java.lang.reflect.Method.invoke(Method.java:606)

                                  at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)

                                  at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)

                                  at org.eclipse.equinox.launcher.Main.run(Main.java:1465)

                                  at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

                                 

                                Hope to help by this.

                                 

                                Thanks,

                                Daan

                                • 13. Re: Problem with Tranformation SQL
                                  shawkins

                                  There is a minor technicality that is preventing the engine from considering 'TRUE' implicitly convertable, which is that the string representation of the true boolean value is 'true'.  So the conversion would be lossy.  You can instead use a boolean literal, just true without the quotes or the string literal 'true'.

                                  • 14. Re: Problem with Tranformation SQL
                                    daan-isaac

                                    Both when using 'TRUE' or 'true', the error is the same: 'ERROR: org.teiid.runtime.client.TeiidClientException: TEIID30145 Unable to convert procedural parameter SourceModel.invokeHttp.stream of type string to expected type boolean.'

                                    When using true, it is automatically converted to TRUE after saving the transformation. This gives the error 'ERROR: java.lang.StringIndexOutOfBoundsException: String index out of range: 1'

                                    1 2 Previous Next