我正在尝试为我的jasperserver使用远程MYSQL源代码。连接良好,不会引发错误。但是,当我尝试在jasperstudio中生成报告时,我收到以下错误
错误日志:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
net.sf.jasperreports.engine.JRRuntimeException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at net.sf.jasperreports.data.jdbc.JdbcDataAdapterService.getConnection(JdbcDataAdapterService.java:166)
at net.sf.jasperreports.data.jdbc.JdbcDataAdapterService.contributeParameters(JdbcDataAdapterService.java:126)
at com.jaspersoft.studio.data.jdbc.JDBCFieldsProvider.getFields(JDBCFieldsProvider.java:52)
at com.jaspersoft.studio.data.jdbc.JDBCDataAdapterDescriptor.getFields(JDBCDataAdapterDescriptor.java:83)
at com.jaspersoft.studio.data.ui.SimpleQueryWizardDataEditorComposite.readFields(SimpleQueryWizardDataEditorComposite.java:258)
at com.jaspersoft.studio.property.dataset.wizard.WizardDataSourcePage.run(WizardDataSourcePage.java:369)
at com.jaspersoft.studio.wizards.JSSWizardRunnablePage$1.run(JSSWizardRunnablePage.java:84)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForRealName(JRClassLoader.java:175)
at net.sf.jasperreports.data.jdbc.JdbcDataAdapterService.getConnection(JdbcDataAdapterService.java:141)
... 7 more
我在mysql-connector-java-5.1.26-bin.jar
中绝对拥有驱动程序类/opt/jasperreports-server-cp-5.5.0/lib
。
我在类路径/opt/jasperreports-server-cp-5.5.0/webapps/jasperserver/WEB-INF/lib中也有相同的connector.jar ...仍然没有。
我不确定问题是什么......任何帮助都将不胜感激!谢谢!
答案 0 :(得分:0)
解决了!!
我必须将驱动程序添加到jasper套件中的类路径中!
答案 1 :(得分:0)
sudo dnf install mysql-connector-java
updatedb
locate mysql-connector-java.jar
然后只需在JasperSoft“Driver Classpath”选项卡中添加绝对路径。