[ https://issues.apache.org/jira/browse/KYLIN-1464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15184611#comment-15184611 ]
hongbin ma commented on KYLIN-1464: ----------------------------------- add a model and add a cube might be two separate opts. Typically we can iterate all models under a project without touching the cubes.There is a field in project instance named "models", which tracks all the models contained by current project. The code block staring from https://github.com/binmahone/kylin/blob/2e1d2f6b62903b16b17bd2442e3456107dc0aa6a/core-metadata/src/main/java/org/apache/kylin/metadata/MetadataManager.java#L327 might give you the impression that model depends on cube. Actually the block was for backward compatibility concerning old metadata formats where there was no "models" field in project instance. The approach was ugly, so the author wrote TODO at the beginning of it. > org.apache.kylin.cube.CubeInstance.getDataModelDesc throw > java.lang.NullPointerException > ---------------------------------------------------------------------------------------- > > Key: KYLIN-1464 > URL: https://issues.apache.org/jira/browse/KYLIN-1464 > Project: Kylin > Issue Type: Bug > Reporter: yunjiong zhao > Assignee: yunjiong zhao > Attachments: KYLIN-1464.patch > > > User report can't see models from Web UI. > After I check log, I found java.lang.NullPointerException > {quote} > 2016-03-02 08:06:59,645 ERROR [http-bio-7070-exec-22] > controller.BasicController:44 : > java.lang.NullPointerException > at > org.apache.kylin.cube.CubeInstance.getDataModelDesc(CubeInstance.java:128) > at > org.apache.kylin.metadata.MetadataManager.getModels(MetadataManager.java:326) > at > org.apache.kylin.rest.service.ModelService.listAllModels(ModelService.java:55) > at > org.apache.kylin.rest.service.ModelService.getModels(ModelService.java:74) > at > org.apache.kylin.rest.service.ModelService$$FastClassByCGLIB$$eb0205be.invoke(<generated>) > at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) > at > org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:618) > at > org.apache.kylin.rest.service.ModelService$$EnhancerByCGLIB$$2e750d6d.getModels(<generated>) > at > org.apache.kylin.rest.controller.ModelController.getModels(ModelController.java:71) > at sun.reflect.GeneratedMethodAccessor164.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213) > at > org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126) > at > org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96) > at > org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617) > at > org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578) > at > org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) > at > org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) > at > org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) > at > org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) > {quote} > And before that we can see from log why it happens. > {quote} > 2016-03-02 08:06:59,238 INFO [http-bio-7070-exec-22] > cube.CubeDescManager:197 : Reloading Cube Metadata from folder > _kylin_metadata_qa2(key='/cube_desc')@_kylin_metadata_qa2@hbase > 2016-03-02 08:06:59,632 ERROR [http-bio-7070-exec-22] > cube.CubeDescManager:207 : Error loading cube desc /cube_desc/test4.json > java.lang.IllegalStateException: Derived can only be defined on lookup table, > cube CubeDesc [name=test4], DimensionDesc > [name=DEFAULT.SLNG_CATEG_META_LVL2_DERIVED, join=null, hierarchy=null, > table=DEFAULT.SLNG_CATEG_META_LVL2, column=null, derived=[CATEG_LVL2_NAME, > META_CATEG_NAME]] > at > org.apache.kylin.cube.model.DimensionDesc.init(DimensionDesc.java:111) > at org.apache.kylin.cube.model.CubeDesc.init(CubeDesc.java:461) > at > org.apache.kylin.cube.CubeDescManager.loadCubeDesc(CubeDescManager.java:134) > at > org.apache.kylin.cube.CubeDescManager.reloadAllCubeDesc(CubeDescManager.java:205) > at > org.apache.kylin.cube.CubeDescManager.<init>(CubeDescManager.java:94) > at > org.apache.kylin.cube.CubeDescManager.getInstance(CubeDescManager.java:74) > at > org.apache.kylin.cube.CubeInstance.getDescriptor(CubeInstance.java:123) > at > org.apache.kylin.cube.CubeInstance.getDataModelDesc(CubeInstance.java:128) > at > org.apache.kylin.metadata.MetadataManager.getModels(MetadataManager.java:326) > at > org.apache.kylin.rest.service.ModelService.listAllModels(ModelService.java:55) > at > org.apache.kylin.rest.service.ModelService.getModels(ModelService.java:74) > at > org.apache.kylin.rest.service.ModelService$$FastClassByCGLIB$$eb0205be.invoke(<generated>) > at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) > at > org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:618) > at > org.apache.kylin.rest.service.ModelService$$EnhancerByCGLIB$$2e750d6d.getModels(<generated>) > at > org.apache.kylin.rest.controller.ModelController.getModels(ModelController.java:71) > at sun.reflect.GeneratedMethodAccessor164.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213) > at > org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java: > {quote} -- This message was sent by Atlassian JIRA (v6.3.4#6332)