实现Olap4J XMLA Server的“没有合适的驱动程序”异常

问题描述 投票:2回答:1

我正在尝试通过HTTP / XMLA实现olap4j-xmlaserver访问Mondrian。我编译了项目,创建了一个war文件(包括一个web.xml文件)并将其部署在Tomcat 7中。问题是当我的数据透视客户端应用程序发送XMLA请求时,我收到异常:

Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:mondrian:Jdbc=jdbc:mysql://localhost:3306/foodmart?user=root&password=xxx;Catalog=/WEB-INF/FoodMart.xml'
        at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
        at mondrian.xmla.impl.Olap4jXmlaServlet$Olap4jPoolingConnectionFactory.getConnection(Olap4jXmlaServlet.java:300)
        at mondrian.xmla.XmlaHandler.getConnection(XmlaHandler.java:2917)
        ... 33 more 

Caused by: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver (DriverManager.java:315)
        at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
        ... 37 more

我把web.xml放在一起(我在olap4j-xmlaserver项目中找不到样本)。我确定需要修复这个web.xml文件来解决问题,尤其是连接字符串:

<web-app ....

  <display-name>olap4j-xmlaserver</display-name>
  <description>
     Olap4J XML/A server
  </description>

  <servlet>
    <servlet-name>xmla</servlet-name>
    <servlet-class>mondrian.xmla.impl.Olap4jXmlaServlet</servlet-class>

    <init-param>
       <param-name>OlapDriverClassName</param-name>
       <param-value>com.mysql.jdbc.Driver</param-value>
    </init-param>

    <init-param>
       <param-name>OlapDriverConnectionString</param-name>
       <param-value>
         jdbc:mondrian:Jdbc=jdbc:mysql://localhost:3306/foodmart?user=root&amp;password=xxx;Catalog=/WEB-INF/FoodMart.xml
       </param-value>
    </init-param>   
  </servlet>

  <servlet-mapping>
    <servlet-name>xmla</servlet-name>
    <url-pattern>/xmla</url-pattern>
  </servlet-mapping>
</web-app>

任何想法如何修复web.xml配置或相关文档的指针将不胜感激。

olap mondrian olap4j
1个回答
2
投票

您在类路径中缺少MySQL的Java驱动程序。将其添加到名为“WEB-INF / lib”的文件夹中的webapp。

© www.soinside.com 2019 - 2024. All rights reserved.