Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: [Mondrian] xmla issues

  1. #1
    Michele Rossi Guest

    Default [Mondrian] xmla issues

    Hi Julian,
    I took the trunk of mondrian and attempted to use the Olap4jXmlaServlet
    finding a couple more issues:

    1. the method below needs to use "getDeclaringClass" and not getClass()

    private static OlapConnection createDelegatingOlapConnection(
    final Connection connection,
    final OlapConnection olapConnection)
    {
    return (OlapConnection) Proxy.newProxyInstance(
    olapConnection.getClass().getClassLoader(),
    new Class[] {OlapConnection.class},
    new InvocationHandler() {
    public Object invoke(
    Object proxy,
    Method method,
    Object[] args)
    throws Throwable
    {
    if (OlapConnection.class.isAssignableFrom(
    method.getDeclaringClass()))
    {
    return method.invoke(olapConnection, args);
    } else {
    return method.invoke(connection, args);
    }
    }
    }
    );
    }
    }

    2. Even with the fix above the method call "unwrap" is sent to the wrapped
    commons-dbcp object which doesn't have it and that causes the Exception
    below.

    2011-08-04 15:44:26,468 ERROR [mondrian.xmla.XmlaServlet] - <Errors when
    handling XML/A message>
    mondrian.xmla.XmlaException: Mondrian Error:XMLA Discover unparse results
    error
    at mondrian.xmla.XmlaHandler.discover(XmlaHandler.java:2812)
    at mondrian.xmla.XmlaHandler.process(XmlaHandler.java:608)
    at
    mondrian.xmla.impl.DefaultXmlaServlet.handleSoapBody(DefaultXmlaServlet.java:557)
    at mondrian.xmla.XmlaServlet.doPost(XmlaServlet.java:315)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at
    org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:883)
    at
    org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:721)
    at
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2258)
    at
    java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.reflect.UndeclaredThrowableException
    at $Proxy0.unwrap(Unknown Source)
    at mondrian.xmla.XmlaHandler.getExtra(XmlaHandler.java:69)
    at
    mondrian.xmla.RowsetDefinition$DbschemaCatalogsRowset.populateImpl(RowsetDefinition.java:2169)
    at mondrian.xmla.Rowset.populate(Rowset.java:220)
    at mondrian.xmla.Rowset.unparse(Rowset.java:192)
    at mondrian.xmla.XmlaHandler.discover(XmlaHandler.java:2806)
    ... 19 more
    Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
    mondrian.xmla.impl.Olap4jXmlaServlet$1.invoke(Olap4jXmlaServlet.java:453)
    ... 25 more
    Caused by: java.lang.AbstractMethodError:
    org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.unwrap(Ljava/lang/ClassLjava/lang/Object;
    ... 30 more


    A possible fix is to add that "catch (AbstractMethodException e)" clause to
    the method below in XmlaHandler.java line 2806


    public static XmlaExtra getExtra(OlapConnection connection) {
    try {
    final XmlaExtra extra = connection.unwrap(XmlaExtra.class);
    if (extra != null) {
    return extra;
    }
    } catch (SQLException e) {
    // Connection cannot provide an XmlaExtra. Fall back and give a
    // default implementation.
    } catch (AbstractMethodError e) {
    // the connection does not implement the "unwrap" method
    }
    return new XmlaExtraImpl();
    }


    What do you think?

    thanks,
    Michele

    _______________________________________________
    Mondrian mailing list
    Mondrian (AT) pentaho (DOT) org
    http://lists.pentaho.org/mailman/listinfo/mondrian

  2. #2
    Julian Hyde Guest

    Default Re: [Mondrian] xmla issues

    On Aug 4, 2011, at 6:57 AM, Michele Rossi wrote:

    > Hi Julian,
    > I took the trunk of mondrian and attempted to use the Olap4jXmlaServlet finding a couple more issues:
    >
    > 1. the method below needs to use "getDeclaringClass" and not getClass()
    >
    > private static OlapConnection createDelegatingOlapConnection(
    > final Connection connection,
    > final OlapConnection olapConnection)
    > {
    > return (OlapConnection) Proxy.newProxyInstance(
    > olapConnection.getClass().getClassLoader(),
    > new Class[] {OlapConnection.class},
    > new InvocationHandler() {
    > public Object invoke(
    > Object proxy,
    > Method method,
    > Object[] args)
    > throws Throwable
    > {
    > if (OlapConnection.class.isAssignableFrom(
    > method.getDeclaringClass()))
    > {
    > return method.invoke(olapConnection, args);
    > } else {
    > return method.invoke(connection, args);
    > }
    > }
    > }
    > );
    > }
    > }


    Agreed.

    >
    > 2. Even with the fix above the method call "unwrap" is sent to the wrapped commons-dbcp object which doesn't have it and that causes the Exception below.
    >
    > 2011-08-04 15:44:26,468 ERROR [mondrian.xmla.XmlaServlet] - <Errors when handling XML/A message>
    > mondrian.xmla.XmlaException: Mondrian Error:XMLA Discover unparse results error
    > at mondrian.xmla.XmlaHandler.discover(XmlaHandler.java:2812)
    > at mondrian.xmla.XmlaHandler.process(XmlaHandler.java:608)
    > at mondrian.xmla.impl.DefaultXmlaServlet.handleSoapBody(DefaultXmlaServlet.java:557)
    > at mondrian.xmla.XmlaServlet.doPost(XmlaServlet.java:315)
    > at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    > at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    > at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    > at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    > at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    > at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    > at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    > at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    > at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:883)
    > at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:721)
    > at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2258)
    > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    > at java.lang.Thread.run(Thread.java:662)
    > Caused by: java.lang.reflect.UndeclaredThrowableException
    > at $Proxy0.unwrap(Unknown Source)
    > at mondrian.xmla.XmlaHandler.getExtra(XmlaHandler.java:69)
    > at mondrian.xmla.RowsetDefinition$DbschemaCatalogsRowset.populateImpl(RowsetDefinition.java:2169)
    > at mondrian.xmla.Rowset.populate(Rowset.java:220)
    > at mondrian.xmla.Rowset.unparse(Rowset.java:192)
    > at mondrian.xmla.XmlaHandler.discover(XmlaHandler.java:2806)
    > ... 19 more
    > Caused by: java.lang.reflect.InvocationTargetException
    > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    > at java.lang.reflect.Method.invoke(Method.java:597)
    > at mondrian.xmla.impl.Olap4jXmlaServlet$1.invoke(Olap4jXmlaServlet.java:453)
    > ... 25 more
    > Caused by: java.lang.AbstractMethodError: org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.unwrap(Ljava/lang/ClassLjava/lang/Object;
    > ... 30 more
    >
    >
    > A possible fix is to add that "catch (AbstractMethodException e)" clause to the method below in XmlaHandler.java line 2806
    >
    >
    > public static XmlaExtra getExtra(OlapConnection connection) {
    > try {
    > final XmlaExtra extra = connection.unwrap(XmlaExtra.class);
    > if (extra != null) {
    > return extra;
    > }
    > } catch (SQLException e) {
    > // Connection cannot provide an XmlaExtra. Fall back and give a
    > // default implementation.
    > } catch (AbstractMethodError e) {
    > // the connection does not implement the "unwrap" method
    > }
    > return new XmlaExtraImpl();
    > }
    >
    >
    > What do you think?


    Are you running JDK 1.5? If so, java.sql.Connection does not implement "unwrap" (it was introduced in JDBC 4.0, i.e. JDK 1.6) but org.olap4j.OlapConnection implements a similar-looking-but-different "unwrap" method.

    In any case, the "unwrap" and "isWrapperFor" methods -- i.e. the methods on java.sql.Wrapper -- should be handled differently than regular methods. I'm not sure whether they should be dispatched to olapConnection or connection, but try both. I don't think we should handle AbstractMethodException -- that is a sign that we are dispatching to the wrong place.

    Julian

    _______________________________________________
    Mondrian mailing list
    Mondrian (AT) pentaho (DOT) org
    http://lists.pentaho.org/mailman/listinfo/mondrian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.