Saiku ui deployed separately saiku No query found with name

1.1k views Asked by At

I am trying to integrate saiku-ui with my custom web application (say x.com). This communicates with saiku-server deployed somewhere else (say y.com)

I've modified security settings so that users are authenticated anonymously which I got using these changes to application-context-saiku-webapp.xml

<security:http auto-config='true' access-denied-page="/login.jsp">
<security:intercept-url pattern="/serverdocs/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<security:intercept-url pattern="/rest/saiku/session*" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<security:intercept-url pattern="/rest/saiku/session/" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<security:intercept-url pattern="/rest/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<security:intercept-url pattern="/json/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />

The problem I am facing is that I am not able to save query anonymously

When I do this post call,

curl -X POST -H "Content-Type: application/json" --data '{"schema":["FoodMart"],"formatter":["flattened"],"connection":["foodmart"],"catalog":["FoodMart"],"cube":["HR"],"type":["QM"]}' http:///saiku/rest/saiku/admin/query/3A956804-01EC-6B3D-A8B9-31EEB8CC2747

I get this response

{"uniqueName":"[foodmart].[FoodMart].[FoodMart].[HR].[3A956804-01EC-6B3D-A8B9-31EEB8CC2747]","name":"3A956804-01EC-6B3D-A8B9-31EEB8CC2747","cube":{"uniqueName":"[foodmart].[FoodMart].[FoodMart].[HR]","name":"HR","connectionName":"foodmart","catalogName":"FoodMart","schemaName":"FoodMart","caption":"HR","visible":true,"cubeName":"[HR]"},"mdx":"SELECT\nFROM [HR]","type":"QM","properties":{"saiku.olap.query.limit":"true","saiku.olap.query.filter":"true","org.saiku.query.explain":"true","org.saiku.connection.scenario":"false","saiku.olap.query.nonempty":"true","saiku.olap.query.nonempty.rows":"true","saiku.olap.query.nonempty.columns":"true","saiku.olap.query.drillthrough":"true"},"saikuAxes":[{"uniqueName":"COLUMNS","name":"COLUMNS","dimensionSelections":[],"ordinal":0,"sortOrder":null,"sortLiteral":null,"limitFunction":null,"limitFunctionN":null,"limitFunctionSortLiteral":null,"filterCondition":null},{"uniqueName":"ROWS","name":"ROWS","dimensionSelections":[],"ordinal":1,"sortOrder":null,"sortLiteral":null,"limitFunction":null,"limitFunctionN":null,"limitFunctionSortLiteral":null,"filterCondition":null},{"uniqueName":"FILTER","name":"FILTER","dimensionSelections":[],"ordinal":-1,"sortOrder":null,"sortLiteral":null,"limitFunction":null,"limitFunctionN":null,"limitFunctionSortLiteral":null,"filterCondition":null}]}

and catalina.out says

2014-01-01 17:50:09,877 DEBUG [org.saiku.web.rest.resources.QueryResource] TRACK /query/3A956804-01EC-6B3D-A8B9-31EEB8CC2747 POST xml:false but when I try to get the same query using

curl -XGET http:///saiku/rest/saiku/admin/query/3A956804-01EC-6B3D-A8B9-31EEB8CC2747

I get "No query found using name"

org.saiku.service.util.exception.SaikuServiceException: No query found using name: 3A956804-01EC-6B3D-A8B9-31EEB8CC2747
org.saiku.service.olap.OlapQueryService.getIQuery(OlapQueryService.java:1015)
org.saiku.service.olap.OlapQueryService.getQuery(OlapQueryService.java:175)
org.saiku.web.rest.resources.QueryResource.getQuery(QueryResource.java:126)
org.saiku.web.rest.resources.QueryResource$$FastClassByCGLIB$$e130f1a0.invoke(<generated>)
net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:617)
org.saiku.web.rest.resources.QueryResource$$EnhancerByCGLIB$$e19ca8a4.getQuery(<generated>)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)

What is going wrong here?

1

There are 1 answers

0
amrk7 On BEST ANSWER

This was happening because, there was no session context. Got around by simulating login from my web service!