javamysqljasper-reportstomcat7jasperserver

Remote MYSQL on jasperreports error: com.mysql.jdbc.Driver not found


I am trying to use a remote MYSQL source for my jasperserver. The connection is good and does not throw an error. However, when I try to make a report in jasperstudio, I get the following error

Error log:

 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

I absolutely have the driver class mysql-connector-java-5.1.26-bin.jar in /opt/jasperreports-server-cp-5.5.0/lib too.

I also have the same connector.jar in the class path /opt/jasperreports-server-cp-5.5.0/webapps/jasperserver/WEB-INF/lib ... still nothing.

I'm not sure what the problem is...any help would be appreciated! Thanks!


Solution

  • SOLVED IT!!

    I had to add the driver to the class path in jasper suite too!