4 Replies Latest reply on Aug 16, 2010 5:53 AM by Rakesh Balguri

    No sources were given for the model error

    Rakesh Balguri Expert

      Hi all,

       

      I had created a custom connector which returns random numbers and deployed it into the JBoss AS.

       

      I created a relational model and added a base table and column to it and selected the Translator as the one which I created.

       

      Then from designer I executed a select command for the base table which I created and I am getting the following error

       

      Also find the attached VDB and the Translator which I am using.

       

      Unexpected exception for request iyMEM619cYBN.0
      No sources were given for the model RandomGenerator
          at org.teiid.dqp.internal.process.CachedFinder.findCapabilities(CachedFinder.java:93)
          at org.teiid.query.optimizer.relational.rules.CapabilitiesUtil.getCapabilities(CapabilitiesUtil.java:365)
          at org.teiid.query.optimizer.relational.rules.CapabilitiesUtil.supports(CapabilitiesUtil.java:385)
          at org.teiid.query.optimizer.relational.rules.CapabilitiesUtil.requiresCriteria(CapabilitiesUtil.java:370)
          at org.teiid.query.optimizer.relational.rules.RulePlaceAccess.addAccessNode(RulePlaceAccess.java:147)
          at org.teiid.query.optimizer.relational.rules.RulePlaceAccess.execute(RulePlaceAccess.java:81)
          at org.teiid.query.optimizer.relational.RelationalPlanner.executeRules(RelationalPlanner.java:364)
          at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:165)
          at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:106)
          at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:423)
          at org.teiid.dqp.internal.process.Request.processRequest(Request.java:446)
          at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:346)
          at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:167)
          at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:49)
          at org.teiid.dqp.internal.process.DQPWorkContext$2.call(DQPWorkContext.java:190)
          at org.teiid.dqp.internal.process.DQPWorkContext$2.call(DQPWorkContext.java:187)
          at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:176)
          at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:187)
          at org.teiid.dqp.internal.process.StatsCapturingWorkManager$WorkWrapper.run(StatsCapturingWorkManager.java:102)
          at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:205)
          at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
          at java.lang.Thread.run(Thread.java:619)

       

       

      Please help me in solving the issue

       

      Thanks

      Rakesh

        • 1. Re: No sources were given for the model error
          Ramesh Reddy Master
          No sources were given for the model RandomGenerator

          If you read this error, what this error is saying is you have not defined any target 'source' for your "RandomGenerator" model. i.e. not specified the "translator" name or "JNDI Name". A model is just metadata, for runtime you must configure, what type of source it is a.k.a "translator" and where it gets the physical data from a.k.a "Data Source". The JNDI name is reference to a data source.

           

          Although, in this particular case you do not need "JNDI Name" as your translator is mocking data up. Like the in this discussion

           

          http://community.jboss.org/message/556799#556799

           

          you need to set the "translator" name when you create the VDB.

           

          Then from designer I executed a select command for the base table which I created and I am getting the following error

           

          Execution from Designer is not as stright forward. First you need to follow these directions to deploy your translator, then restart the JBoss AS. Then you can execute from Designer. As with out deployment of your translator Teiid runtime will not know about your translator.

           

          When you do not have a physical source like in your "RandomGenerator" case, you need to override "isSourceRequired" method in the "ExecutionFactory" and return "false" in your extended execution factory class.

           

          @Override
          public boolean isSourceRequired() {
                  return false;
          }
          

           

          Hope this helps.

           

          Ramesh..

          • 2. Re: No sources were given for the model error
            Rakesh Balguri Expert

            Hi Ramesh,

             

            I had added the isSourceRequired() method for the ExecutionFactory and deployed the VDB and also the translator to JBoss.

             

            I had created a source model and added a table as Random and then tried to execute the query select * from Random but I am getting the following error and I am not sure of the problem

             

            I tried the same on 7.1 CR2 release

             

            2010-08-13 15:51:17,382 ERROR [org.teiid.CONNECTOR] (WorkManager(2)-16_QueryProcessorQueue14) Connector worker process failed for atomic-request=B864vYM1CIx9.0.1.0
            java.lang.ArrayIndexOutOfBoundsException: 1
                at org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem.correctTypes(ConnectorWorkItem.java:401)
                at org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem.handleBatch(ConnectorWorkItem.java:331)
                at org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem.execute(ConnectorWorkItem.java:304)
                at org.teiid.dqp.internal.process.DataTierTupleSource.open(DataTierTupleSource.java:118)
                at org.teiid.dqp.internal.process.DataTierTupleSource.nextTuple(DataTierTupleSource.java:82)
                at org.teiid.query.processor.relational.AccessNode.nextBatchDirect(AccessNode.java:136)
                at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:260)
                at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:106)
                at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:157)
                at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:107)
                at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:67)
                at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:247)
                at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:177)
                at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:49)
                at org.teiid.dqp.internal.process.DQPWorkContext$2.call(DQPWorkContext.java:190)
                at org.teiid.dqp.internal.process.DQPWorkContext$2.call(DQPWorkContext.java:187)
                at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:176)
                at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:187)
                at org.teiid.dqp.internal.process.StatsCapturingWorkManager$WorkWrapper.run(StatsCapturingWorkManager.java:102)
                at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:205)
                at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
                at java.lang.Thread.run(Thread.java:619)
            2010-08-13 15:51:17,382 ERROR [org.teiid.PROCESSOR] (WorkManager(2)-16_QueryProcessorQueue14) Unexpected exception for request B864vYM1CIx9.0
            java.lang.ArrayIndexOutOfBoundsException: 1
                at org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem.correctTypes(ConnectorWorkItem.java:401)
                at org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem.handleBatch(ConnectorWorkItem.java:331)
                at org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem.execute(ConnectorWorkItem.java:304)
                at org.teiid.dqp.internal.process.DataTierTupleSource.open(DataTierTupleSource.java:118)
                at org.teiid.dqp.internal.process.DataTierTupleSource.nextTuple(DataTierTupleSource.java:82)
                at org.teiid.query.processor.relational.AccessNode.nextBatchDirect(AccessNode.java:136)
                at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:260)
                at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:106)
                at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:157)
                at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:107)
                at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:67)
                at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:247)
                at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:177)
                at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:49)
                at org.teiid.dqp.internal.process.DQPWorkContext$2.call(DQPWorkContext.java:190)
                at org.teiid.dqp.internal.process.DQPWorkContext$2.call(DQPWorkContext.java:187)
                at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:176)
                at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:187)
                at org.teiid.dqp.internal.process.StatsCapturingWorkManager$WorkWrapper.run(StatsCapturingWorkManager.java:102)
                at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:205)
                at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
                at java.lang.Thread.run(Thread.java:619)

             

             

            Please help me in solving the problem

             

            Thanks

            Rakesh

            • 3. Re: No sources were given for the model error
              Ramesh Reddy Master

              Rakesh,

               

              You were returning the results wrong in the "RandomResultSetExecution" class.  I changed to look as below

               

              public List<?> next() throws TranslatorException, DataNotAvailableException {
                      if (!randomNumbers.isEmpty()) {
                          return Arrays.asList(randomNumbers.remove(0));
                      }
                      return null;
              }
              

               

              This above expects a "single" row at a time. The list contains all the columns you would like to expose.

               

              I am also attaching a new jar with few other comments.

               

              Ramesh..

              • 4. Re: No sources were given for the model error
                Rakesh Balguri Expert

                Hi Ramesh,

                 

                It workedThanks for your help.

                I was not aware of returning one row at a time in the next() method.

                 

                I had successfully created a Custom Translator in Teiid

                 

                thanks

                Rakesh