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

时间:2018-09-06 03:02:55

标签: olap mondrian olap4j

我正在尝试实现olap4j-xmlaserver以通过HTTP / XMLA访问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配置或指向相关文档的指针的想法都会受到赞赏。

1 个答案:

答案 0 :(得分:2)

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