Unable to move TASM ruleset to READY or make it ACTIVE in Teradata Viewpoint Workload Designer (There was an error executing the request in TASM)

Problem:

We have created a ruleset by cloning it from other ruleset but we are unable to move it to READY not make it ACTIVE.

The error on the portlet is " There was an error executing the request "

Cause:

Found the following error in viewpoint.log in /var/opt/teradata/viewpoint/portal/logs:

2020-12-22 10:22:15,236 ERROR [http-nio-9080-exec-41] {context=/TasmConfiguratorPortlet, user=xyz} controllers.RulesetSummaryController.copyToTeradata(842) - Error copying RulesetId: SystemId = 5, ConfigId = -29 to Teradata

org.springframework.dao.DataIntegrityViolationException:

### Error updating database. Cause: java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.01] [Error 2802] [SQLState 23000] Duplicate row error in tdwm.RuleQualifyCriteria.

### The error may involve RuleQualifyCriteria.SetRuleQualifyCriteria-Inline

### The error occurred while setting parameters

### SQL: LOCKING TABLE tdwm.RuleQualifyCriteria FOR WRITE INSERT INTO tdwm.RuleQualifyCriteria ( createDate, createTime, removeDate, removeTime, description, configId, parentId, versionno, ruleId, crowId, excludeFlag, criterionType, integerValue, floatValue, charValue, queryBandValue, dataObjectId ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? );

### Cause: java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.01] [Error 2802] [SQLState 23000] Duplicate row error in tdwm.RuleQualifyCriteria.

; SQL []; [Teradata Database] [TeraJDBC 16.20.00.01] [Error 2802] [SQLState 23000] Duplicate row error in tdwm.RuleQualifyCriteria.; nested exception is java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.01] [Error 2802] [SQLState 23000] Duplicate row error in tdwm.RuleQualifyCriteria.

at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:100) ~[spring-jdbc-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) ~[spring-jdbc-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) ~[spring-jdbc-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) ~[spring-jdbc-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73) ~[mybatis-spring-1.2.2.jar:1.2.2]

at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371) ~[mybatis-spring-1.2.2.jar:1.2.2]

at com.sun.proxy.$Proxy38.insert(Unknown Source) ~[?:?]

at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:240) ~[mybatis-spring-1.2.2.jar:1.2.2]

at com.teradata.tasm.monitor.dao.ibatis.TDWMConfigurationDAOiBatis.finishSaveToTeradata(TDWMConfigurationDAOiBatis.java:845) ~[vp-commons-tasm-16.20.23.00.jar:16.20.23.00-b349]

at com.teradata.tasm.monitor.dao.ibatis.TDWMConfigurationDAOiBatis.saveRuleSetToTeradataImpl(TDWMConfigurationDAOiBatis.java:1051) ~[vp-commons-tasm-16.20.23.00.jar:16.20.23.00-b349]

at com.teradata.tasm.monitor.dao.ibatis.TDWMConfigurationDAOiBatis.access$000(TDWMConfigurationDAOiBatis.java:91) ~[vp-commons-tasm-16.20.23.00.jar:16.20.23.00-b349]

at com.teradata.tasm.monitor.dao.ibatis.TDWMConfigurationDAOiBatis$1.doInTransaction(TDWMConfigurationDAOiBatis.java:870) ~[vp-commons-tasm-16.20.23.00.jar:16.20.23.00-b349]

at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) ~[spring-tx-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at com.teradata.tasm.monitor.dao.ibatis.TDWMConfigurationDAOiBatis.saveRuleSetToTeradata(TDWMConfigurationDAOiBatis.java:862) ~[vp-commons-tasm-16.20.23.00.jar:16.20.23.00-b349]

at com.teradata.portlets.tasmconfigurator.service.impl.TeradataTasmManagerImpl.saveViewpointRulesetToTeradata(TeradataTasmManagerImpl.java:260) ~[TeradataTasmManagerImpl.class:?]

at com.teradata.portlets.tasmconfigurator.service.impl.RulesetManagerImpl$1.doInTransaction(RulesetManagerImpl.java:774) ~[RulesetManagerImpl$1.class:?]

at com.teradata.portlets.tasmconfigurator.service.impl.RulesetManagerImpl$1.doInTransaction(RulesetManagerImpl.java:756) ~[RulesetManagerImpl$1.class:?]

at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) ~[spring-tx-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at com.teradata.portlets.tasmconfigurator.service.impl.RulesetManagerImpl.saveViewpointRulesetToTeradata(RulesetManagerImpl.java:755) ~[RulesetManagerImpl.class:?]

at com.teradata.portlets.tasmconfigurator.service.impl.RulesetManagerImpl.copyToTeradata(RulesetManagerImpl.java:673) ~[RulesetManagerImpl.class:?]

at sun.reflect.GeneratedMethodAccessor15112.invoke(Unknown Source) ~[?:?]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_191]

at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_191]

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198) ~[spring-aop-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at com.sun.proxy.$Proxy169.copyToTeradata(Unknown Source) ~[?:?]

at sun.reflect.GeneratedMethodAccessor15112.invoke(Unknown Source) ~[?:?]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_191]

at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_191]

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) ~[spring-aop-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) ~[spring-aop-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at com.teradata.commons.util.cache.advice.CacheInterceptor.flush(CacheInterceptor.java:322) ~[vp-commons-utils-16.20.23.00.jar:16.20.23.00-b349]

at com.teradata.commons.util.cache.advice.CacheInterceptor.invoke(CacheInterceptor.java:175) ~[vp-commons-utils-16.20.23.00.jar:16.20.23.00-b349]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) ~[spring-aop-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) ~[spring-aop-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at com.sun.proxy.$Proxy170.copyToTeradata(Unknown Source) ~[?:?]

at com.teradata.portlets.tasmconfigurator.controllers.RulesetSummaryController.copyToTeradata(RulesetSummaryController.java:827) [RulesetSummaryController.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_191]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_191]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_191]

at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_191]

at com.teradata.portlets.mvc.ServletRenderController.processRequest(ServletRenderController.java:250) [vp-commons-portlets-16.20.23.00.jar:16.20.23.00-b349]

at com.teradata.portlets.mvc.ServletRenderController.handleRequestInternal(ServletRenderController.java:223) [vp-commons-portlets-16.20.23.00.jar:16.20.23.00-b349]

at com.teradata.portlets.mvc.ServletRenderController.handleRequestInternal(ServletRenderController.java:172) [vp-commons-portlets-16.20.23.00.jar:16.20.23.00-b349]

at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) [spring-webmvc-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at com.teradata.portlets.handler.ServletRenderHandlerAdapter.handle(ServletRenderHandlerAdapter.java:155) [vp-commons-portlets-16.20.23.00.jar:16.20.23.00-b349]

at com.teradata.portlets.handler.ServletRenderHandlerAdapter.handle(ServletRenderHandlerAdapter.java:141) [vp-commons-portlets-16.20.23.00.jar:16.20.23.00-b349]

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:933) [spring-webmvc-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:867) [spring-webmvc-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:951) [spring-webmvc-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:853) [spring-webmvc-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at javax.servlet.http.HttpServlet.service(HttpServlet.java:650) [servlet-api.jar:?]

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:827) [spring-webmvc-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) [servlet-api.jar:?]

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) [catalina.jar:7.0.68]

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.68]

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat7-websocket.jar:7.0.68]

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.68]

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.68]

at com.teradata.viewpoint.cache.CacheFilter.doFilter(CacheFilter.java:87) [vp-portal-api-16.20.23.00.jar:16.20.23.00-b349]

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.68]

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.68]

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106) [spring-web-3.2.18.RELEASE.jar:3.2.18.RELEASE]

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.68]

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.68]

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) [catalina.jar:7.0.68]

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.68]

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:614) [catalina.jar:7.0.68]

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) [catalina.jar:7.0.68]

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:7.0.68]

at com.teradata.viewpoint.portal.container.log.LogValve.invoke(LogValve.java:77) [lib/:?]

at com.teradata.viewpoint.portal.container.security.SecurityValve.invoke(SecurityValve.java:315) [lib/:?]

at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:321) [catalina.jar:7.0.68]

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.68]

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) [catalina.jar:7.0.68]

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) [tomcat-coyote.jar:7.0.68]

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) [tomcat-coyote.jar:7.0.68]

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1757) [tomcat-coyote.jar:7.0.68]

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1716) [tomcat-coyote.jar:7.0.68]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152) [?:1.7.0_191]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622) [?:1.7.0_191]

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.68]

at java.lang.Thread.run(Thread.java:745) [?:1.7.0_191]

Caused by: java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.01] [Error 2802] [SQLState 23000] Duplicate row error in tdwm.RuleQualifyCriteria.

at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDatabaseSQLException(ErrorFactory.java:309) ~[terajdbc4-16.20.0.1.jar:16.20.00.01]

at com.teradata.jdbc.jdbc_4.statemachine.ReceiveInitSubState.action(ReceiveInitSubState.java:103) ~[terajdbc4-16.20.0.1.jar:16.20.00.01]

at com.teradata.jdbc.jdbc_4.statemachine.StatementReceiveState.subStateMachine(StatementReceiveState.java:311) ~[terajdbc4-16.20.0.1.jar:16.20.00.01]

at com.teradata.jdbc.jdbc_4.statemachine.StatementReceiveState.action(StatementReceiveState.java:200) ~[terajdbc4-16.20.0.1.jar:16.20.00.01]

at com.teradata.jdbc.jdbc_4.statemachine.StatementController.runBody(StatementController.java:137) ~[terajdbc4-16.20.0.1.jar:16.20.00.01]

at com.teradata.jdbc.jdbc_4.statemachine.PreparedStatementController.run(PreparedStatementController.java:46) ~[terajdbc4-16.20.0.1.jar:16.20.00.01]

at com.teradata.jdbc.jdbc_4.TDStatement.executeStatement(TDStatement.java:389) ~[terajdbc4-16.20.0.1.jar:16.20.00.01]

at com.teradata.jdbc.jdbc_4.TDStatement.executeStatement(TDStatement.java:331) ~[terajdbc4-16.20.0.1.jar:16.20.00.01]

at com.teradata.jdbc.jdbc_4.TDPreparedStatement.doPrepExecute(TDPreparedStatement.java:177) ~[terajdbc4-16.20.0.1.jar:16.20.00.01]

at com.teradata.jdbc.jdbc_4.TDPreparedStatement.execute(TDPreparedStatement.java:2778) ~[terajdbc4-16.20.0.1.jar:16.20.00.01]

at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:44) ~[mybatis-3.2.7.jar:3.2.7]

at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:69) ~[mybatis-3.2.7.jar:3.2.7]

at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:48) ~[mybatis-3.2.7.jar:3.2.7]

at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:105) ~[mybatis-3.2.7.jar:3.2.7]

at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:71) ~[mybatis-3.2.7.jar:3.2.7]

at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:152) ~[mybatis-3.2.7.jar:3.2.7]

at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:141) ~[mybatis-3.2.7.jar:3.2.7]

at sun.reflect.GeneratedMethodAccessor2663.invoke(Unknown Source) ~[?:?]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_191]

at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_191]

at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358) ~[mybatis-spring-1.2.2.jar:1.2.2]

... 79 more

Solution:

Cloned the ruleset and make it ready or activate.