java.lang.Integer不能转换为java.lang.String异常

时间:2017-04-21 15:12:52

标签: java postgresql mdx pentaho mondrian

我在运行我的mdx查询时遇到了这个错误..我真的无法理解这个错误,我多次再次做了多维数据集但我仍然遇到这个错误! 这是完整的错误:

Warning: Could not get charToByteConverterClass!
Warning: Could not get charToByteConverterClass!
Warning: Could not get charToByteConverterClass!
Warning: Could not get charToByteConverterClass!
Warning: Could not get charToByteConverterClass!
Warning: Could not get charToByteConverterClass!
Warning: Could not get charToByteConverterClass!
[JPivot] 21 apr 2017 16:48:13,861 ERROR [Session 08BEA8C58E687AE8F99184BC19FA07A1] com.tonbeller.wcf.component.RendererTag#doEndTag: trouble rendering table01
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
    at mondrian.rolap.RolapMemberBase.getName(RolapMemberBase.java:233)
    at mondrian.olap.OlapElementBase.getCaption(OlapElementBase.java:84)
    at mondrian.olap.MemberBase.getCaption(MemberBase.java:108)
    at mondrian.rolap.DelegatingRolapMember.getCaption(DelegatingRolapMember.java:176)
    at com.tonbeller.jpivot.mondrian.MondrianMember.getLabel(MondrianMember.java:79)
    at com.tonbeller.jpivot.table.SpanBuilderImpl$RenderSwitch.visitMember(SpanBuilderImpl.java:111)
    at com.tonbeller.jpivot.mondrian.MondrianMember.accept(MondrianMember.java:161)
    at com.tonbeller.jpivot.table.SpanBuilderImpl.build(SpanBuilderImpl.java:142)
    at com.tonbeller.jpivot.table.SpanBuilderDecorator.build(SpanBuilderDecorator.java:34)
    at com.tonbeller.jpivot.table.navi.DrillExpandUI$DomDecorator.build(DrillExpandUI.java:81)
    at com.tonbeller.jpivot.table.SpanBuilderDecorator.build(SpanBuilderDecorator.java:34)
    at com.tonbeller.jpivot.table.navi.DrillExpandUI$DomDecorator.build(DrillExpandUI.java:81)
    at com.tonbeller.jpivot.table.SpanBuilderDecorator.build(SpanBuilderDecorator.java:34)
    at com.tonbeller.jpivot.table.navi.DrillExpandUI$DomDecorator.build(DrillExpandUI.java:81)
    at com.tonbeller.jpivot.table.AxisHeaderBuilderSupport.build(AxisHeaderBuilderSupport.java:63)
    at com.tonbeller.jpivot.table.AxisBuilderSupport.buildHeading(AxisBuilderSupport.java:253)
    at com.tonbeller.jpivot.table.RowAxisBuilderImpl.buildRow(RowAxisBuilderImpl.java:51)
    at com.tonbeller.jpivot.table.TableComponent.buildRows2Dim(TableComponent.java:490)
    at com.tonbeller.jpivot.table.TableComponent.render2(TableComponent.java:274)
    at com.tonbeller.jpivot.table.TableComponent.render(TableComponent.java:235)
    at com.tonbeller.wcf.component.RendererTag.doEndTag(RendererTag.java:137)
    at org.apache.jsp.testpage_jsp._jspx_meth_wcf_005frender_005f6(testpage_jsp.java:1398)
    at org.apache.jsp.testpage_jsp._jspService(testpage_jsp.java:238)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.tonbeller.wcf.controller.RequestFilter$MyHandler.normalRequest(RequestFilter.java:139)
    at com.tonbeller.wcf.controller.RequestFilter.doFilter(RequestFilter.java:264)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[JPivot] 21 apr 2017 16:48:13,956 ERROR [Session 08BEA8C58E687AE8F99184BC19FA07A1] com.tonbeller.wcf.controller.RequestFilter$MyHandler#handleException: exeption
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.tonbeller.wcf.controller.RequestFilter$MyHandler.normalRequest(RequestFilter.java:139)
    at com.tonbeller.wcf.controller.RequestFilter.doFilter(RequestFilter.java:264)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
    at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:908)
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)
    at org.apache.jsp.testpage_jsp._jspService(testpage_jsp.java:272)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    ... 23 more
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
    at mondrian.rolap.RolapMemberBase.getName(RolapMemberBase.java:233)
    at mondrian.olap.OlapElementBase.getCaption(OlapElementBase.java:84)
    at mondrian.olap.MemberBase.getCaption(MemberBase.java:108)
    at mondrian.rolap.DelegatingRolapMember.getCaption(DelegatingRolapMember.java:176)
    at com.tonbeller.jpivot.mondrian.MondrianMember.getLabel(MondrianMember.java:79)
    at com.tonbeller.jpivot.table.SpanBuilderImpl$RenderSwitch.visitMember(SpanBuilderImpl.java:111)
    at com.tonbeller.jpivot.mondrian.MondrianMember.accept(MondrianMember.java:161)
    at com.tonbeller.jpivot.table.SpanBuilderImpl.build(SpanBuilderImpl.java:142)
    at com.tonbeller.jpivot.table.SpanBuilderDecorator.build(SpanBuilderDecorator.java:34)
    at com.tonbeller.jpivot.table.navi.DrillExpandUI$DomDecorator.build(DrillExpandUI.java:81)
    at com.tonbeller.jpivot.table.SpanBuilderDecorator.build(SpanBuilderDecorator.java:34)
    at com.tonbeller.jpivot.table.navi.DrillExpandUI$DomDecorator.build(DrillExpandUI.java:81)
    at com.tonbeller.jpivot.table.SpanBuilderDecorator.build(SpanBuilderDecorator.java:34)
    at com.tonbeller.jpivot.table.navi.DrillExpandUI$DomDecorator.build(DrillExpandUI.java:81)
    at com.tonbeller.jpivot.table.AxisHeaderBuilderSupport.build(AxisHeaderBuilderSupport.java:63)
    at com.tonbeller.jpivot.table.AxisBuilderSupport.buildHeading(AxisBuilderSupport.java:253)
    at com.tonbeller.jpivot.table.RowAxisBuilderImpl.buildRow(RowAxisBuilderImpl.java:51)
    at com.tonbeller.jpivot.table.TableComponent.buildRows2Dim(TableComponent.java:490)
    at com.tonbeller.jpivot.table.TableComponent.render2(TableComponent.java:274)
    at com.tonbeller.jpivot.table.TableComponent.render(TableComponent.java:235)
    at com.tonbeller.wcf.component.RendererTag.doEndTag(RendererTag.java:137)
    at org.apache.jsp.testpage_jsp._jspx_meth_wcf_005frender_005f6(testpage_jsp.java:1398)
    at org.apache.jsp.testpage_jsp._jspService(testpage_jsp.java:238)
    ... 26 more
[JPivot] 21 apr 2017 16:48:14,081 ERROR [Session 08BEA8C58E687AE8F99184BC19FA07A1] com.tonbeller.wcf.controller.RequestFilter$MyHandler#handleException: cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
    at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:908)
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)
    at org.apache.jsp.testpage_jsp._jspService(testpage_jsp.java:272)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.tonbeller.wcf.controller.RequestFilter$MyHandler.normalRequest(RequestFilter.java:139)
    at com.tonbeller.wcf.controller.RequestFilter.doFilter(RequestFilter.java:264)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
    at mondrian.rolap.RolapMemberBase.getName(RolapMemberBase.java:233)
    at mondrian.olap.OlapElementBase.getCaption(OlapElementBase.java:84)
    at mondrian.olap.MemberBase.getCaption(MemberBase.java:108)
    at mondrian.rolap.DelegatingRolapMember.getCaption(DelegatingRolapMember.java:176)
    at com.tonbeller.jpivot.mondrian.MondrianMember.getLabel(MondrianMember.java:79)
    at com.tonbeller.jpivot.table.SpanBuilderImpl$RenderSwitch.visitMember(SpanBuilderImpl.java:111)
    at com.tonbeller.jpivot.mondrian.MondrianMember.accept(MondrianMember.java:161)
    at com.tonbeller.jpivot.table.SpanBuilderImpl.build(SpanBuilderImpl.java:142)
    at com.tonbeller.jpivot.table.SpanBuilderDecorator.build(SpanBuilderDecorator.java:34)
    at com.tonbeller.jpivot.table.navi.DrillExpandUI$DomDecorator.build(DrillExpandUI.java:81)
    at com.tonbeller.jpivot.table.SpanBuilderDecorator.build(SpanBuilderDecorator.java:34)
    at com.tonbeller.jpivot.table.navi.DrillExpandUI$DomDecorator.build(DrillExpandUI.java:81)
    at com.tonbeller.jpivot.table.SpanBuilderDecorator.build(SpanBuilderDecorator.java:34)
    at com.tonbeller.jpivot.table.navi.DrillExpandUI$DomDecorator.build(DrillExpandUI.java:81)
    at com.tonbeller.jpivot.table.AxisHeaderBuilderSupport.build(AxisHeaderBuilderSupport.java:63)
    at com.tonbeller.jpivot.table.AxisBuilderSupport.buildHeading(AxisBuilderSupport.java:253)
    at com.tonbeller.jpivot.table.RowAxisBuilderImpl.buildRow(RowAxisBuilderImpl.java:51)
    at com.tonbeller.jpivot.table.TableComponent.buildRows2Dim(TableComponent.java:490)
    at com.tonbeller.jpivot.table.TableComponent.render2(TableComponent.java:274)
    at com.tonbeller.jpivot.table.TableComponent.render(TableComponent.java:235)
    at com.tonbeller.wcf.component.RendererTag.doEndTag(RendererTag.java:137)
    at org.apache.jsp.testpage_jsp._jspx_meth_wcf_005frender_005f6(testpage_jsp.java:1398)
    at org.apache.jsp.testpage_jsp._jspService(testpage_jsp.java:238)
    ... 26 more

这是查询:

SELECT {[Measures].[quantita_media], [Measures].[quantita_totale]} ON
COLUMNS,
{([Periodo], [Articolo], [ScontrinoFiscale])} ON ROWS
FROM [Vendite]

这是postgresql架构:

CREATE TABLE data_dt (
    data character varying(10) NOT NULL,
    giorno character varying(10) NOT NULL,
    mese character varying(10) NOT NULL,
    anno character varying(4) NOT NULL
);

CREATE TABLE prodotto_dt (
    nome character varying(30) NOT NULL,
    descrizione character varying(30) NOT NULL
);
CREATE TABLE scontrino_dt (
    codice integer NOT NULL,
    totale integer NOT NULL
);
CREATE TABLE vendita_ft (
    data character varying(10) NOT NULL,
    nome character varying(30) NOT NULL,
    codice integer NOT NULL,
    quantita integer NOT NULL
);
ALTER TABLE ONLY data_dt
    ADD CONSTRAINT data_dt_pkey PRIMARY KEY (data);
ALTER TABLE ONLY prodotto_dt
    ADD CONSTRAINT prodotto_dt_pkey PRIMARY KEY (nome);
ALTER TABLE ONLY scontrino_dt
    ADD CONSTRAINT scontrino_dt_pkey PRIMARY KEY (codice);
ALTER TABLE ONLY vendita_ft
    ADD CONSTRAINT vendita_ft_pkey PRIMARY KEY (data, nome, codice);
ALTER TABLE ONLY vendita_ft
    ADD CONSTRAINT vendita_ft_codice_fkey FOREIGN KEY (codice) REFERENCES scontrino_dt(codice);
ALTER TABLE ONLY vendita_ft
    ADD CONSTRAINT vendita_ft_data_fkey FOREIGN KEY (data) REFERENCES data_dt(data);
ALTER TABLE ONLY vendita_ft
    ADD CONSTRAINT vendita_ft_nome_fkey FOREIGN KEY (nome) REFERENCES prodotto_dt(nome);

这是我的架构工作台生成的xml多维数据集:

<Schema name="New Schema1">
  <Cube name="Vendite" cache="true" enabled="true">
    <Table name="vendita_ft" schema="public">
    </Table>
    <Dimension type="StandardDimension" foreignKey="data" highCardinality="false" name="Periodo">
      <Hierarchy name="tempo" hasAll="true">
        <Table name="data_dt" schema="public">
        </Table>
        <Level name="giorno" table="data_dt" column="giorno" nameColumn="giorno" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
        <Level name="mese" table="data_dt" column="mese" nameColumn="mese" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
        <Level name="anno" table="data_dt" column="anno" nameColumn="anno" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>
    <Dimension type="StandardDimension" foreignKey="nome" highCardinality="false" name="Articolo">
      <Hierarchy name="prodotto" hasAll="true">
        <Table name="prodotto_dt" schema="public">
        </Table>
        <Level name="nome" table="prodotto_dt" column="nome" nameColumn="nome" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
        <Level name="descrizione" table="prodotto_dt" column="descrizione" nameColumn="descrizione" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>
    <Dimension type="StandardDimension" foreignKey="codice" highCardinality="false" name="ScontrinoFiscale">
      <Hierarchy name="scontrino" hasAll="true">
        <Table name="scontrino_dt" schema="public">
        </Table>
        <Level name="codice" table="scontrino_dt" column="codice" nameColumn="codice" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
        <Level name="totale" table="scontrino_dt" column="totale" nameColumn="totale" type="Integer" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
        </Level>
      </Hierarchy>
    </Dimension>
    <Measure name="quantita_media" column="quantita" aggregator="avg" visible="true">
    </Measure>
    <Measure name="quantita_totale" column="quantita" datatype="Integer" aggregator="sum" visible="true">
    </Measure>
  </Cube>
</Schema>

2 个答案:

答案 0 :(得分:0)

我想我找到了它。在你的表中&#34; scontrino_dt&#34;你宣布&#34; codice&#34;和&#34; totale&#34;作为整数。

CREATE TABLE scontrino_dt (
    codice integer NOT NULL,
    totale integer NOT NULL
);

但是在你的XML中你设置了&#34; codice&#34;字符串!

<Level name="codice" table="scontrino_dt" column="codice" nameColumn="codice" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
</Level>
<Level name="totale" table="scontrino_dt" column="totale" nameColumn="totale" type="Integer" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
</Level>

答案 1 :(得分:0)

您使用的大多数技术我都不熟悉,如果没有帮助,请原谅我。

就我mdx来说,这条线看起来太详细了:

{([Periodo], [Articolo], [ScontrinoFiscale])} ON ROWS

通常在mdx中,您需要声明要显示的级别或层次结构,而上面看起来只是维度名称。请先尝试用以下内容替换上面一行:

{[Periodo].[giorno].MEMBERS} ON ROWS

或者这个:

{[Periodo].[tempo].[giorno].MEMBERS} ON ROWS

你还有错误吗?如果没有,那么有几个hiearchies ON ROWS你需要找到在蒙德里安执行cross join的方式 - 在ssas中,它是通过*运算符完成的:

 {[Periodo].[tempo].[giorno].MEMBERS 
* [Articolo].[prodotto].[nome].MEMBERS} ON ROWS

在蒙德里安,您可能需要使用CROSSJOIN函数:

 CROSSJOIN(
    [Periodo].[tempo].[giorno].MEMBERS 
   ,[Articolo].[prodotto].[nome].MEMBERS) ON ROWS