[APPM-1197] Error when loading stores of migrated tenants which are not loaded Created: 17/Dec/15  Updated: 18/Dec/15  Resolved: 18/Dec/15

Status: Resolved
Project: ZZZ-WSO2 App Manager
Component/s: None
Affects Version/s: 1.1.0
Fix Version/s: 1.1.0

Type: Bug Priority: High
Reporter: Asanthi Kulasinghe Assignee: Dinusha Dilrukshi
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

All datasources pointed to MySQL
wso2appm-1.1.0-SNAPSHOT-16-12-2015
JDK 1.7
Ubuntu 13.04


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

 Description   

Go to public store and try to load a tenant store of a tenant (migrated for AppM 1.0.0 to AppM 1.1.0) which has not yet been load ( not yet logged in)
The following error is thrown


[2015-12-17 16:03:15,288] ERROR - WebAppManager org.mozilla.javascript.WrappedException: Wrapped org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "assets" from null (/store/modules/store.js#241) (/store/controllers/ref_tenant_router.jag#97)
org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.WrappedException: Wrapped org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "assets" from null (/store/modules/store.js#241) (/store/controllers/ref_tenant_router.jag#97)
	at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:571)
	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.doGet(JaggeryServlet.java:24)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
	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:62)
	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:744)
Caused by: org.mozilla.javascript.WrappedException: Wrapped org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "assets" from null (/store/modules/store.js#241) (/store/controllers/ref_tenant_router.jag#97)
	at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754)
	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148)
	at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:386)
	at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
	at org.jaggeryjs.rhino.store.controllers.c0._c_resolveRouter_3(/store/controllers/ref_tenant_router.jag:97)
	at org.jaggeryjs.rhino.store.controllers.c0.call(/store/controllers/ref_tenant_router.jag)
	at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
	at org.jaggeryjs.rhino.store.controllers.c0._c_script_0(/store/controllers/ref_tenant_router.jag:77)
	at org.jaggeryjs.rhino.store.controllers.c0.call(/store/controllers/ref_tenant_router.jag)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
	at org.jaggeryjs.rhino.store.controllers.c0.call(/store/controllers/ref_tenant_router.jag)
	at org.jaggeryjs.rhino.store.controllers.c0.exec(/store/controllers/ref_tenant_router.jag)
	at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
	... 37 more
Caused by: org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "assets" from null (/store/modules/store.js#241)
	at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:571)
	at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
	at org.jaggeryjs.jaggery.core.manager.WebAppManager.executeScript(WebAppManager.java:279)
	at org.jaggeryjs.jaggery.core.manager.WebAppManager.include(WebAppManager.java:133)
	at sun.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)
	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)
	... 49 more
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "assets" from null (/store/modules/store.js#241)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3687)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3665)
	at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3693)
	at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3712)
	at org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3725)
	at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1483)
	at org.jaggeryjs.rhino.store.modules.c1._c_anonymous_13(/store/modules/store.js:241)
	at org.jaggeryjs.rhino.store.modules.c1.call(/store/modules/store.js)
	at org.mozilla.javascript.BaseFunction.construct(BaseFunction.java:338)
	at org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:2349)
	at org.jaggeryjs.rhino.store.modules.c1._c_anonymous_10(/store/modules/store.js:197)
	at org.jaggeryjs.rhino.store.modules.c1.call(/store/modules/store.js)
	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
	at org.jaggeryjs.rhino.store.modules.c1._c_anonymous_69(/store/modules/store.js:1086)
	at org.jaggeryjs.rhino.store.modules.c1.call(/store/modules/store.js)
	at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23)
	at org.mozilla.javascript.gen._store__server_js_11._c_anonymous_17([store]/server.js:286)
	at org.mozilla.javascript.gen._store__server_js_11.call([store]/server.js)
	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
	at org.jaggeryjs.rhino.store.modules.c1._c_anonymous_68(/store/modules/store.js:1080)
	at org.jaggeryjs.rhino.store.modules.c1.call(/store/modules/store.js)
	at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
	at org.jaggeryjs.rhino.store.controllers.c1._c_script_0(/store/controllers/top-assets.jag:9)
	at org.jaggeryjs.rhino.store.controllers.c1.call(/store/controllers/top-assets.jag)
	at org.jaggeryjs.rhino.store.controllers.c1.exec(/store/controllers/top-assets.jag)
	at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
	... 56 more




 Comments   
Comment by Jenananthan Yogendran [ 18/Dec/15 ]

Fixed https://github.com/wso2/product-app-manager/commit/a5a416c3fbdd4695500d39bdde146404fa66ac23

Comment by Asanthi Kulasinghe [ 18/Dec/15 ]

Tested in 18th December pack for migrated and newly created tenants. This is fixed now.

Generated at Mon Oct 26 20:22:20 PDT 2020 using JIRA 7.2.2#72004-sha1:9d5132893cc8c728a3601a9034a1f8547ef5c7be.