Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-5258

TEIID30151 Error building Source for context item

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 10.1
    • XML Connector
    • None
    • Hide

      1. Add file resource adapter configuration in standalone-teiid.xml and put in the testdata folder the failed.json file (see in attachment):

      <resource-adapter id="file">
                          <module slot="main" id="org.jboss.teiid.resource-adapter.file"/>
                          <connection-definitions>
                              <connection-definition class-name="org.teiid.resource.adapter.file.FileManagedConnectionFactory" jndi-name="java:/files" enabled="true" pool-name="files">
                                  <config-property name="AllowParentPaths">
                                      true
                                  </config-property>
                                  <config-property name="ParentDirectory">
                                      C:/testdata
                                  </config-property>
                              </connection-definition>
                          </connection-definitions>
                      </resource-adapter>
      

      2. Add translator "myFiles" in /deployments/test-vdb.xml:

      <translator name="myFiles" type="file"/>
      

      3. Add "files" model in /deployments/test-vdb.xml:

      <model name="files">
              <source name="files" translator-name="myFiles" connection-jndi-name="java:/files"/>
      </model>
      

      4. Run the following script:

      Begin
      	with t As (
      		Select campaign_id, email_address, activity
      		From (
      			call files.getFiles(pathAndPattern => 'failed.json')
      		) f 
      		Cross Join
      		XmlTable (
      			'/root/emails'
      			Passing JsonToXml('root', f.file)
      			Columns
      				campaign_id string,
      				list_id string,
      				list_is_active boolean,
      				email_id string,
      				email_address string,
      				activity xml
      		) x
      		Where activity Is Not Null
      	)		
      	Select *
      	From t Cross Join XmlTable (
      		'/root/activity'
      		Passing XmlElement(root, t.activity)
      		Columns
      			action string,
      			"timestamp" timestamp,
      			url string,
      			ip string
      		) a;
      End;
      
      Show
      1. Add file resource adapter configuration in standalone-teiid.xml and put in the testdata folder the failed.json file (see in attachment): <resource-adapter id= "file" > <module slot= "main" id= "org.jboss.teiid.resource-adapter.file" /> <connection-definitions> <connection-definition class-name= "org.teiid.resource.adapter.file.FileManagedConnectionFactory" jndi-name= "java:/files" enabled= "true" pool-name= "files" > <config-property name= "AllowParentPaths" > true </config-property> <config-property name= "ParentDirectory" > C:/testdata </config-property> </connection-definition> </connection-definitions> </resource-adapter> 2. Add translator "myFiles" in /deployments/test-vdb.xml: <translator name= "myFiles" type= "file" /> 3. Add "files" model in /deployments/test-vdb.xml: <model name= "files" > <source name= "files" translator-name= "myFiles" connection-jndi-name= "java:/files" /> </model> 4. Run the following script: Begin with t As ( Select campaign_id, email_address, activity From ( call files.getFiles(pathAndPattern => 'failed.json' ) ) f Cross Join XmlTable ( '/root/emails' Passing JsonToXml( 'root' , f. file ) Columns campaign_id string , list_id string , list_is_active boolean , email_id string , email_address string , activity xml ) x Where activity Is Not Null ) Select * From t Cross Join XmlTable ( '/root/activity' Passing XmlElement(root, t.activity) Columns action string , " timestamp " timestamp , url string , ip string ) a ; End ;

      When running the following script:

      Begin
      	with t As (
      		Select campaign_id, email_address, activity
      		From (
      			call files.getFiles(pathAndPattern => 'failed.json')
      		) f 
      		Cross Join
      		XmlTable (
      			'/root/emails'
      			Passing JsonToXml('root', f.file)
      			Columns
      				campaign_id string,
      				list_id string,
      				list_is_active boolean,
      				email_id string,
      				email_address string,
      				activity xml
      		) x
      		Where activity Is Not Null
      	)		
      	Select *
      	From t Cross Join XmlTable (
      		'/root/activity'
      		Passing XmlElement(root, t.activity)
      		Columns
      			action string,
      			"timestamp" timestamp,
      			url string,
      			ip string
      		) a;
      End;
      

      teiid throws out the following error:

      Unable to find source-code formatter for language: noformat. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      2018-02-13 17:55:47,054 WARN  [org.teiid.PROCESSOR] (Worker2_QueryProcessorQueue7) /okCCfP2/yjh TEIID30020 Processing exception for request /okCCfP2/yjh.0 'TEIID30151 Error building
      Source for context item.'. Originally TeiidProcessingException StaxToEventBridge.java:325.: org.teiid.core.TeiidProcessingException: TEIID30151 Error building Source for context item
      .
              at org.teiid.query.xquery.saxon.XQueryEvaluator.evaluateXQuery(XQueryEvaluator.java:163)
              at org.teiid.query.processor.relational.XMLTableNode$1.run(XMLTableNode.java:265)
              at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:280)
              at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:115)
              at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:206)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at java.lang.Thread.run(Thread.java:745)
      Caused by: nu.xom.ParsingException
              at nu.xom.Builder.build(Unknown Source)
              at nu.xom.Builder.build(Unknown Source)
              at org.teiid.query.xquery.saxon.XQueryEvaluator.evaluateXQuery(XQueryEvaluator.java:157)
              ... 7 more
      Caused by: java.lang.NullPointerException
              at net.sf.saxon.evpull.StaxToEventBridge.getSystemId(StaxToEventBridge.java:325)
              at net.sf.saxon.evpull.StaxToEventBridge.getSystemId(StaxToEventBridge.java:385)
              at net.sf.saxon.event.ContentHandlerProxyLocator.getSystemId(ContentHandlerProxyLocator.java:72)
              at nu.xom.XOMHandler.startElement(Unknown Source)
              at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:373)
              at org.teiid.query.xquery.saxon.ContentHandlerProxyReceiver.startContent(StreamingUtils.java:291)
              at net.sf.saxon.event.ProxyReceiver.startContent(ProxyReceiver.java:177)
              at org.teiid.query.xquery.saxon.PathMapFilter.startContent(PathMapFilter.java:226)
              at net.sf.saxon.event.TreeReceiver.startContent(TreeReceiver.java:220)
              at net.sf.saxon.evpull.EventIteratorToReceiver.copy(EventIteratorToReceiver.java:78)
              at net.sf.saxon.event.Sender.sendPullEventSource(Sender.java:559)
              at net.sf.saxon.event.Sender.send(Sender.java:132)
              at net.sf.saxon.Configuration.buildDocument(Configuration.java:3361)
              at net.sf.saxon.Configuration.buildDocument(Configuration.java:3303)
              at org.teiid.query.xquery.saxon.SaxonReader.parse(StreamingUtils.java:175)
              ... 10 more
      

              rhn-engineering-shawkins Steven Hawkins
              dalex005 Dmitrii Pogorelov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: