[Mondrian] xmla issues

Michele Rossi michele.rossi at gmail.com
Thu Aug 4 09:58:08 EDT 2011


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/Class;)Ljava/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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20110804/33c7d370/attachment-0001.html 


More information about the Mondrian mailing list