1

I'm trying to get Birt 4.2.0 working on a Tomcat 6.0 server, and I simply can not get it to load the mySql JDBC driver. My report works fine in Eclipse's preview, and it works fine when I feed it to the ReportEngine, but the web viewer keeps spitting out this exception:

SEVERE: DriverClassLoader failed to load class: com.mysql.jdbc.Driver
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at org.eclipse.birt.core.framework.URLClassLoader.findClass1(URLClassLoader.java:188)
    at org.eclipse.birt.core.framework.URLClassLoader$1.run(URLClassLoader.java:156)
    at org.eclipse.birt.core.framework.URLClassLoader$1.run(URLClassLoader.java:1)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.birt.core.framework.URLClassLoader.findClass(URLClassLoader.java:151)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager.loadExtraDriver(JDBCDriverManager.java:1024)
    at org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager.findDriver(JDBCDriverManager.java:819)
    at org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager.loadAndRegisterDriver(JDBCDriverManager.java:946)

(followed by about eighty more lines of stacktracing, which I have omitted for brevity)

I have mysql-connector-java-5.1.21-bin.jar, which I've placed in /usr/local/apache-tomcat-6.0.33/webapps/birt/WEB-INF/lib. After a lot of googling, I've also tried putting it in many other places, including /usr/local/apache-tomcat-6.0.33/lib, /usr/local/apache-tomcat-6.0.33/common/lib, and /usr/local/apache-tomcat-6.0.33/webapps/birt/WEB-INF/platform/plugins/org.eclipse.birt.report.data.oda.jdbc_5.1.21/drivers. None had any impact. The data source in my .rptdesign file reads as follows:

<data-sources>
    <oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Playrific live" id="49">
        <list-property name="privateDriverProperties">
            <ex-property>
                <name>metadataBidiFormatStr</name>
                <value>ILYNN</value>
            </ex-property>
            <ex-property>
                <name>disabledMetadataBidiFormatStr</name>
            </ex-property>
            <ex-property>
                <name>contentBidiFormatStr</name>
                <value>ILYNN</value>
            </ex-property>
            <ex-property>
                <name>disabledContentBidiFormatStr</name>
            </ex-property>
        </list-property>
        <property name="odaDriverClass">com.mysql.jdbc.Driver</property>
        <property name="odaURL">jdbc:mysql://10.177.134.242:3406/db_playsmrt</property>
        <property name="odaUser">[redacted]</property>
        <encrypted-property name="odaPassword" encryptionID="base64">[redacted]</encrypted-property>
    </oda-data-source>
</data-sources>

At this point, the only thing I can think of is that either mysql-connector-java-5.1.21-bin.jar belongs in yet another location that I haven't tried yet, or there's some environmental variable somewhere that needs to be set, but I can't find anything about what that could be. Does anyone have any idea what's going on?

Update

Annnd a reboot fixed it. I feel stupid now.

4

1 回答 1

0

我在尝试在 jboss eap 6.1 中运行我的 BIRT 报告时遇到了非常相似的情况,其中我的 mysql 驱动程序配置为 jboss 模块。我的应用程序按预期工作,但 BIRT 找不到 com.mysql.jdbc.Driver。为了解决它,我添加了

 <module name="com.mysql" export="true"/>

到我的 jboss-deployment-structure.xml 文件,以便容器导出 com.mysql 依赖项并且 BIRT 的 JDBCDriverManager 可以看到它。我重新部署了我的应用程序并且它有效。

于 2014-03-02T10:13:55.447 回答