Uploaded image for project: 'ZZZ-WSO2 App Manager'
  1. ZZZ-WSO2 App Manager
  2. APPM-1178

Error on store during log out and subscription [ External store related]

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.1.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      AppM 9th Dec pack
      Ubuntu 14.04
      JDK 1.7
      Clusterd setup ( 2 publisher , 2 sotres, 2 GWs, 2 idps fronted by Nginx / DB : MySQL)

    • Severity:
      Major
    • Estimated Complexity:
      Moderate
    • Test cases added:
      Yes

      Description

      Login to tenantA
      Click on an app published on tenantA's store by tenantB.
      -TenantB's store is loaded and the app is displayed.
      Click on logout or subscribe

      The following error occurs

      TID: [0] [AM] [2015-12-11 12:42:27,270] ERROR {org.wso2.carbon.appmgt.impl.dao.AppMDAO} -  Error occurred while updating Store hits: (Web app UUID: e46aad13-72c9-462b-9c0b-acbbbab11ed6, UserId : tenant22@tenant22.com, TenantId : 4) : Cannot add or update a child row: a foreign key constraint fails (`am_appm110`.`APM_APP_HITS`, CONSTRAINT `APM_APP_HITS_ibfk_1` FOREIGN KEY (`TENANT_ID`, `USER_ID`) REFERENCES `APM_SUBSCRIBER` (`TENANT_ID`, `USER_ID`)) {org.wso2.carbon.appmgt.impl.dao.AppMDAO}
      com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`am_appm110`.`APM_APP_HITS`, CONSTRAINT `APM_APP_HITS_ibfk_1` FOREIGN KEY (`TENANT_ID`, `USER_ID`) REFERENCES `APM_SUBSCRIBER` (`TENANT_ID`, `USER_ID`))
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      	at com.mysql.jdbc.Util.handleNewInstance(Util.java:389)
      	at com.mysql.jdbc.Util.getInstance(Util.java:372)
      	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:973)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3835)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3771)
      	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
      	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
      	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2535)
      	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1911)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2145)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2081)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2066)
      	at org.wso2.carbon.appmgt.impl.dao.AppMDAO.insertStoreHits(AppMDAO.java:6609)
      	at org.wso2.carbon.appmgt.impl.dao.AppMDAO.saveStoreHits(AppMDAO.java:6570)
      	at org.wso2.carbon.appmgt.usage.publisher.APPMgtUiActivitiesBamDataPublisher.publishUserActivityEvents(APPMgtUiActivitiesBamDataPublisher.java:241)
      	at org.wso2.carbon.appmgt.usage.publisher.APPMgtUiActivitiesBamDataPublisher.processUiActivityObject(APPMgtUiActivitiesBamDataPublisher.java:183)
      	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.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
      	at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
      	at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
      	at org.jaggeryjs.rhino.store.apis.c0._c_anonymous_1(/store/apis/eventpublish.jag:45)
      	at org.jaggeryjs.rhino.store.apis.c0.call(/store/apis/eventpublish.jag)
      	at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23)
      	at org.jaggeryjs.rhino.store.apis.c0._c_script_0(/store/apis/eventpublish.jag:19)
      	at org.jaggeryjs.rhino.store.apis.c0.call(/store/apis/eventpublish.jag)
      	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
      	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
      	at org.jaggeryjs.rhino.store.apis.c0.call(/store/apis/eventpublish.jag)
      	at org.jaggeryjs.rhino.store.apis.c0.exec(/store/apis/eventpublish.jag)
      	at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
      	at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
      	at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:536)
      	at org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
      	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
      	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:378)
      	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
      	at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      	at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
      	at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
      	at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56)
      	at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
      	at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
      	at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
      	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      	at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
      	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736)
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:745)
      TID: [0] [AM] [2015-12-11 12:42:27,285] ERROR {org.wso2.carbon.appmgt.usage.publisher.APPMgtUiActivitiesBamDataPublisher} -  Failed to write to table : Error occurred while updating Store hits: (Web app UUID: e46aad13-72c9-462b-9c0b-acbbbab11ed6, UserId : tenant22@tenant22.com, TenantId : 4) : Cannot add or update a child row: a foreign key constraint fails (`am_appm110`.`APM_APP_HITS`, CONSTRAINT `APM_APP_HITS_ibfk_1` FOREIGN KEY (`TENANT_ID`, `USER_ID`) REFERENCES `APM_SUBSCRIBER` (`TENANT_ID`, `USER_ID`)) {org.wso2.carbon.appmgt.usage.publisher.APPMgtUiActivitiesBamDataPublisher}
      org.wso2.carbon.appmgt.api.AppManagementException: Error occurred while updating Store hits: (Web app UUID: e46aad13-72c9-462b-9c0b-acbbbab11ed6, UserId : tenant22@tenant22.com, TenantId : 4) : Cannot add or update a child row: a foreign key constraint fails (`am_appm110`.`APM_APP_HITS`, CONSTRAINT `APM_APP_HITS_ibfk_1` FOREIGN KEY (`TENANT_ID`, `USER_ID`) REFERENCES `APM_SUBSCRIBER` (`TENANT_ID`, `USER_ID`))
      	at org.wso2.carbon.appmgt.impl.dao.AppMDAO.handleException(AppMDAO.java:4786)
      	at org.wso2.carbon.appmgt.impl.dao.AppMDAO.insertStoreHits(AppMDAO.java:6616)
      	at org.wso2.carbon.appmgt.impl.dao.AppMDAO.saveStoreHits(AppMDAO.java:6570)
      	at org.wso2.carbon.appmgt.usage.publisher.APPMgtUiActivitiesBamDataPublisher.publishUserActivityEvents(APPMgtUiActivitiesBamDataPublisher.java:241)
      	at org.wso2.carbon.appmgt.usage.publisher.APPMgtUiActivitiesBamDataPublisher.processUiActivityObject(APPMgtUiActivitiesBamDataPublisher.java:183)
      	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.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
      	at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
      	at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
      	at org.jaggeryjs.rhino.store.apis.c0._c_anonymous_1(/store/apis/eventpublish.jag:45)
      	at org.jaggeryjs.rhino.store.apis.c0.call(/store/apis/eventpublish.jag)
      	at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23)
      	at org.jaggeryjs.rhino.store.apis.c0._c_script_0(/store/apis/eventpublish.jag:19)
      	at org.jaggeryjs.rhino.store.apis.c0.call(/store/apis/eventpublish.jag)
      	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
      	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
      	at org.jaggeryjs.rhino.store.apis.c0.call(/store/apis/eventpublish.jag)
      	at org.jaggeryjs.rhino.store.apis.c0.exec(/store/apis/eventpublish.jag)
      	at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
      	at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
      	at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:536)
      	at org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
      	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
      	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:378)
      	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
      	at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      	at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
      	at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
      	at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56)
      	at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
      	at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
      	at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
      	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      	at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
      	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736)
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`am_appm110`.`APM_APP_HITS`, CONSTRAINT `APM_APP_HITS_ibfk_1` FOREIGN KEY (`TENANT_ID`, `USER_ID`) REFERENCES `APM_SUBSCRIBER` (`TENANT_ID`, `USER_ID`))
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      	at com.mysql.jdbc.Util.handleNewInstance(Util.java:389)
      	at com.mysql.jdbc.Util.getInstance(Util.java:372)
      	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:973)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3835)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3771)
      	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
      	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
      	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2535)
      	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1911)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2145)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2081)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2066)
      	at org.wso2.carbon.appmgt.impl.dao.AppMDAO.insertStoreHits(AppMDAO.java:6609)
      	... 57 more
      
      

        Attachments

          Activity

            People

            • Assignee:
              dinusha@wso2.com Dinusha Dilrukshi
              Reporter:
              asanthi@wso2.com Asanthi Kulasinghe
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: