4 Replies Latest reply on Oct 19, 2012 2:18 AM by Vineela Gampa

    Nullpointer exception when running an update statement for the second time

    Vineela Gampa Novice

      Hi

       

      Iam running into this NPE when i run an update statement against a view which has a trigger associated (thats constructed using dynamic sql instruction).Security_ldap is an ldap translator. I have attached the test class for reference.

       

      <metadata type="DDL">

           creaet view BASEUSER......

       

           CREATE TRIGGER ON BASEUSER INSTEAD OF UPDATE

                              AS FOR EACH ROW

                                  BEGIN ATOMIC

                                      DECLARE string setclause = null;

                                      DECLARE string whereClause = 'security_ldap.BASEUSER.DN'||'='||'new.USERID'||' AND '||'SECURITY_LDAP.BASEUSER.SYSID'||'='||'new.SYSID';

                                      IF (CHANGING.NAME)

                                          BEGIN

                                              setclause = 'security_ldap.BASEUSER.NAME'||'='||'new.name';

                                          END

                                      EXECUTE IMMEDIATE 'UPDATE security_ldap.BASEUSER SET ' || setclause || ' WHERE '||whereClause;

                                  END;

      </METADATA>

       

      org.teiid.jdbc.TeiidSQLException: org.teiid.core.TeiidException

          at org.teiid.jdbc.TeiidSQLException.create(TeiidSQLException.java:113)

          at org.teiid.jdbc.TeiidSQLException.create(TeiidSQLException.java:70)

          at org.teiid.jdbc.StatementImpl.postReceiveResults(StatementImpl.java:654)

          at org.teiid.jdbc.StatementImpl.access$100(StatementImpl.java:62)

          at org.teiid.jdbc.StatementImpl$2.onCompletion(StatementImpl.java:565)

          at org.teiid.client.util.ResultsFuture.done(ResultsFuture.java:130)

          at org.teiid.client.util.ResultsFuture.access$200(ResultsFuture.java:37)

          at org.teiid.client.util.ResultsFuture$1.receiveResults(ResultsFuture.java:75)

          at org.teiid.net.socket.SocketServerInstanceImpl.receivedMessage(SocketServerInstanceImpl.java:222)

          at org.teiid.net.socket.SocketServerInstanceImpl.read(SocketServerInstanceImpl.java:257)

          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:601)

          at org.teiid.net.socket.SocketServerConnectionFactory$ShutdownHandler.invoke(SocketServerConnectionFactory.java:102)

          at $Proxy1.read(Unknown Source)

          at org.teiid.net.socket.SocketServerInstanceImpl$RemoteInvocationHandler$1.get(SocketServerInstanceImpl.java:356)

          at org.teiid.jdbc.StatementImpl.executeSql(StatementImpl.java:574)

          at org.teiid.jdbc.PreparedStatementImpl.executeUpdate(PreparedStatementImpl.java:226)

          at com.ca.test.ParameterRepalcementTest.main(ParameterRepalcementTest.java:25)

      Caused by: [TeiidException]

      1 [NullPointerException]

          at org.teiid.client.ResultsMessage.setException(ResultsMessage.java:172)

          at org.teiid.dqp.internal.process.RequestWorkItem.sendError(RequestWorkItem.java:787)

          at org.teiid.dqp.internal.process.RequestWorkItem.close(RequestWorkItem.java:483)

          at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:318)

          at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:49)

          at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:219)

          at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:249)

          at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:123)

          at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:298)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

          at java.lang.Thread.run(Thread.java:722)

      Caused by: java.lang.NullPointerException

          at org.teiid.query.optimizer.relational.PlanToProcessConverter.convert(PlanToProcessConverter.java:101)

          at org.teiid.dqp.internal.process.multisource.MultiSourcePlanToProcessConverter.convert(MultiSourcePlanToProcessConverter.java:94)

          at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:201)

          at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:188)

          at org.teiid.query.processor.proc.ExecDynamicSqlInstruction.process(ExecDynamicSqlInstruction.java:183)

          at org.teiid.query.processor.proc.ProcedurePlan.processProcedure(ProcedurePlan.java:365)

          at org.teiid.query.processor.proc.ProcedurePlan.nextBatchDirect(ProcedurePlan.java:293)

          at org.teiid.query.processor.proc.ProcedurePlan.nextBatch(ProcedurePlan.java:266)

          at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:143)

          at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:109)

          at org.teiid.query.processor.proc.ForEachRowPlan.nextBatch(ForEachRowPlan.java:119)

          at org.teiid.query.processor.relational.PlanExecutionNode.nextBatchDirect(PlanExecutionNode.java:118)

          at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:279)

          at org.teiid.query.processor.relational.ProjectNode.nextBatchDirect(ProjectNode.java:146)

          at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:279)

          at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:148)

          at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:143)

          at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:109)

          at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:153)

          at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:382)

          at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:291)

          ... 8 more