Hello,
after update from 6.12.0 to 6.20.3 i became an error: "net.sf.jasperreports.engine.JRRuntimeException: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver cannot be found by net.sf.jasperreports_6.20.3.final" on all my reports.
After testing the connections i get the same error.
I have the jar files for sqljdbc42, 7.0.0.jre10, 7.0.0.jre8, 7.2.2.jre11, 7.2.2.jre8, 9.2.1.jre8. 9.2.1.jre11, 9.2.1.jre15, 12.2.0.jre11, 12.2.0.jre8 under plugins.
What can i do that it works right again?
3 Answers:
Are these DB connections configured in JasperStudio or JasperServer (or both)? It seems you need to add the MS SQL Server JDBC Jar lib in studio via Preferences - > Java -> Build Path -> User Libraries. MS SQL Server DB connections typically require this addition. I know I've had to add that JDBC Jar directly many times over.
If this doesn't work let me know, just post back any supplemental info you can.
Thanks for your answer. I have created a new UserLibrary named MS SQL under BuildPath and testet with mssql-jdbc-7.0.0.jre10.jar, mssql-jdbc-7.0.0.jre8.jar and sqljdbc42.jar. Nothing works.
Interestingly, I have a GIT repository with the DataSources (which worked previously). And a newly created project without DataSources. It works in the newly created project. Not in my GIT repository. And I wonder why not.
I don´t know witch jar i need. Microsoft SQL Server Version is 2022 64-Bit KB5026717.
net.sf.jasperreports.engine.JRRuntimeException: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver cannot be found by net.sf.jasperreports_6.20.3.final
at net.sf.jasperreports.data.jdbc.JdbcDataAdapterService.getConnection(JdbcDataAdapterService.java:199)
at net.sf.jasperreports.data.jdbc.JdbcDataAdapterService.contributeParameters(JdbcDataAdapterService.java:125)
at net.sf.jasperreports.data.AbstractDataAdapterService.test(AbstractDataAdapterService.java:120)
at com.jaspersoft.studio.data.DataAdapterEditorPart$1$1.runOperations(DataAdapterEditorPart.java:196)
at com.jaspersoft.studio.utils.jobs.CheckedRunnableWithProgress$1.run(CheckedRunnableWithProgress.java:50)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver cannot be found by net.sf.jasperreports_6.20.3.final
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:541)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:536)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:416)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForRealName(JRClassLoader.java:208)
at net.sf.jasperreports.data.jdbc.JdbcDataAdapterService.getConnection(JdbcDataAdapterService.java:158)
As recommended by @darth_fader, the driver should be added to your project in Jaspersoft Studio.
If published to the server you should also add the driver to the server either in the webapps/jasperserver/WEB-INF/lib folder or through the UI when defining the data source connection.
Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.