在单个应用程序服务器中部署多个Saiku应用程序:REST冲突

时间:2014-10-31 11:47:48

标签: rest glassfish saiku

在GlassFish应用程序服务器中部署了一个Saiku实例。

休息后端:saiku 前端:saiku-ui

所以,我提出以下要求:

http://external_ip_here/saiku-ui/

然后我通过授权,创建我需要的OLAP多维数据集,一切正常。

enter image description here

enter image description here

当我尝试在同一个应用程序服务器中安装另一个Saiku实例时,问题就开始了,但是在另一个域中(让我们说domain)。

我将前端部分和其余后端重命名如下:

休息后端:saiku-enterprise 前端:analytic-ui

因此,JavaScript和URL映射中的所有Ajax调用都从/saiku/替换为/saiku-enterprise/

applicationContext-saiku-enterprise.xml(最初名为applicationContext-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_FULLY" />
<security:intercept-url pattern="/json/**" access="IS_AUTHENTICATED_FULLY" />
<security:intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />  
<security:logout logout-url="/logout"/>  
<security:http-basic/>

</security:http>
<import resource="applicationContext-spring-security.xml"/>

web.xml的一部分:

...
<servlet>
   <servlet-name>jersey2</servlet-name>
   <servlet-class>org.codehaus.enunciate.modules.jersey.EnunciateJerseyServletContainer</servlet-class>
   <init-param>
      <param-name>com.sun.jersey.config.property.packages</param-name>
      <param-value>org.saiku.web</param-value>
   </init-param>
   <init-param>
      <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
      <param-value>com.sun.jersey.api.container.filter.PostReplaceFilter</param-value>
   </init-param>
   <init-param>
      <param-name>org.codehaus.enunciate.modules.jersey.config.ServletPath</param-name>
      <param-value>/rest</param-value>
   </init-param>
   <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
   <servlet-name>jersey2</servlet-name>
   <url-pattern>/rest/saiku/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
   <servlet-name>jersey2</servlet-name>
   <url-pattern>/rest/saiku/session</url-pattern>
</servlet-mapping>
...

我重新加载了一个新的Saiku实例(只需在文件\domain\applications\saiku-enterprise\.reload中进行更改 - 之后Saiku会自动重启)

接下来我提出请求:

http://external_ip_here/analytic-ui/

并收到错误(我可以在FifeBug或Google Chrome控制台中看到它):

HTTP Status 404: http://external_ip_here/saiku-enterprise/rest/saiku/session?_=1414754157176

因此,Saiku的新实例不起作用。

enter image description here

在工作配置中(不重命名),此资源可用:

/saiku/rest/saiku/session?_=1414761814333

Remote Address:external_ip_here:80
Request URL:http://external_ip_here/saiku/rest/saiku/session?_=1414761814333
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:application/json, text/javascript, */*; q=0.01
Accept-Encoding:gzip,deflate,sdch
Accept-Language:ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Content-Type:application/x-www-form-urlencoded
Cookie:...
Host:external_ip_here
Referer:http://external_ip_here/saiku-ui/
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36
X-Requested-With:XMLHttpRequest
Query String Parametersview sourceview URL encoded
_:1....
Response Headersview source
Connection:Keep-Alive
Content-Type:application/json
Date:Fri, 31 Oct 2014 13:23:17 GMT
Keep-Alive:timeout=5, max=86
Server:GlassFish Server Open Source Edition 3.1
Transfer-Encoding:chunked
X-Powered-By:Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1 Java/Sun Microsystems Inc./1.6)

如果在客户端我指定BASE_URL == http://127.0.0.1:8080,如下所示:

/**
 * Change settings here
 */
var Settings = {
    VERSION: "Saiku 2.5",
    BIPLUGIN: false,
    BASE_URL: "http://127.0.0.1:8080",
    TOMCAT_WEBAPP: "/saiku-enterprise",
    REST_MOUNT_POINT: "/rest/saiku/",
    DIMENSION_PREFETCH: true,
    ERROR_LOGGING: false,
    // number of erroneous ajax calls in a row before UI cant recover
    ERROR_TOLERANCE: 3,
    QUERY_PROPERTIES: {
        'saiku.olap.query.automatic_execution': 'true',
        'saiku.olap.query.nonempty': 'true',
        'saiku.olap.query.nonempty.rows': 'true',
        'saiku.olap.query.nonempty.columns': 'true',
        'saiku.ui.render.mode' : 'table'
    },
    /* Valid values for CELLSET_FORMATTER:
     * 1) flattened
     * 2) flat
     */
    CELLSET_FORMATTER: "flattened",
    // limits the number of rows in the result
    // 0 - no limit
    RESULT_LIMIT: 0,
    MEMBERS_FROM_RESULT: true,
    PLUGINS: [
        "Chart"
    ],
    TELEMETRY_SERVER: 'http://telemetry.analytical-labs.com:7000',
    LOCALSTORAGE_EXPIRATION: 10 * 60 * 60 * 1000 /* 10 hours, in ms */
};

然后我收到此错误:

Aborted: http://external_ip_here/analytic-ui/

enter image description here

应用程序开始无休止地重新加载..

为了链接前端和后端,我添加了两个bean as recommended

<bean id="platformBean" class="org.saiku.service.PlatformUtilsService">
    <property name="path" value="../../../docroot/analytic-ui/js/saiku/plugins/"/>
</bean>

<bean id="infoResource" class="org.saiku.web.rest.resources.InfoResource">
    <property name="platformUtilsService" ref="platformBean"/>
</bean>

但它没有帮助。

同样的错误:

HTTP Status 404: http://external_ip_here/saiku-enterprise/rest/saiku/session?_=14...

可能是什么问题?我非常感谢这些信息。谢谢大家。

1 个答案:

答案 0 :(得分:0)

我明白了。在静态资源中,应对文件Settings.js进行更改,如下所示:

/**
 * Change settings here
 */
var Settings = {
    VERSION: "Saiku 2.5",
    BIPLUGIN: false,
    BASE_URL: "",
    TOMCAT_WEBAPP: "/saiku-enterprise",
    REST_MOUNT_POINT: "/rest/saiku/",
    DIMENSION_PREFETCH: true,
    ERROR_LOGGING: true,
    // number of erroneous ajax calls in a row before UI cant recover
    ERROR_TOLERANCE: 3,
    QUERY_PROPERTIES: {
        'saiku.olap.query.automatic_execution': 'true',
        'saiku.olap.query.nonempty': 'true',
        'saiku.olap.query.nonempty.rows': 'true',
        'saiku.olap.query.nonempty.columns': 'true',
        'saiku.ui.render.mode' : 'table'
    },
    /* Valid values for CELLSET_FORMATTER:
     * 1) flattened
     * 2) flat
     */
    CELLSET_FORMATTER: "flattened",
    // limits the number of rows in the result
    // 0 - no limit
    RESULT_LIMIT: 0,
    MEMBERS_FROM_RESULT: true,
    PLUGINS: [
        "Chart"
    ],
    TELEMETRY_SERVER: 'http://telemetry.analytical-labs.com:7000',
    LOCALSTORAGE_EXPIRATION: 10 * 60 * 60 * 1000 /* 10 hours, in ms */
};

即指定适当的上下文 - 前端必须指向正确的休息后端

TOMCAT_WEBAPP: "/saiku-enterprise",

不需要在其他地方进行更改(如果您使用它,则除applicationContext-spring-security-jdbc.xml之外)。

enter image description here

现在一切都好。