[#8106] - Creating a Spring Loaded Hibernate Connection

Category:
Bug report
Priority:
High
Status:
New
Project: Severity:
Critical
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:
0

The component com.jaspersoft.studio.hibernate3_3.3.2.GA_01, does not inherit from project classpath, unable to add JDBC Driver Jars :
net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRException: java.lang.reflect.InvocationTargetException
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:537)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$20(ReportControler.java:512)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler$5.run(ReportControler.java:393)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: net.sf.jasperreports.engine.JRException: java.lang.reflect.InvocationTargetException
at net.sf.jasperreports.data.hibernate.spring.SpringHibernateDataAdapterService.contributeParameters(SpringHibernateDataAdapterService.java:92)
at net.sf.jasperreports.engine.fill.JRFillDataset.contributeParameters(JRFillDataset.java:1034)
at net.sf.jasperreports.engine.fill.JRFillDataset.setParameterValues(JRFillDataset.java:634)
at net.sf.jasperreports.engine.fill.BaseReportFiller.setParameters(BaseReportFiller.java:436)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:548)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:123)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.sf.jasperreports.data.hibernate.spring.SpringHibernateDataAdapterService.contributeParameters(SpringHibernateDataAdapterService.java:75)
... 6 more
Caused by: org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:97)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1354)
... 11 more
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/database?autoReconnect=true&useUnicode=true
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
... 15 more

v6.3
j p r's picture
3
Joined: Jul 4 2016 - 8:25am
Last seen: 5 years 4 months ago

2 Comments:

#1

I have the same problem but with connection hibernate session. I use the database PostgreSQL.

net.sf.jasperreports.engine.JRException: java.lang.reflect.InvocationTargetException

at net.sf.jasperreports.data.hibernate.HibernateDataAdapterService.contributeParameters(HibernateDataAdapterService.java:129)

at net.sf.jasperreports.data.AbstractDataAdapterService.test(AbstractDataAdapterService.java:105)

at com.jaspersoft.studio.data.DataAdapterEditorPart$1.widgetSelected(DataAdapterEditorPart.java:170)

at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)

at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)

at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)

at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)

at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)

at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:694)

at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)

at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:606)

at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)

at com.jaspersoft.studio.rcp.intro.Application.start(Application.java:99)

at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)

at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)

at org.eclipse.equinox.launcher.Main.run(Main.java:1515)

Caused by: java.lang.reflect.InvocationTargetException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at net.sf.jasperreports.data.hibernate.HibernateDataAdapterService.contributeParameters(HibernateDataAdapterService.java:108)

... 29 more

Caused by: org.hibernate.exception.JDBCConnectionException: Cannot open connection

at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:97)

at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)

at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)

at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)

at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)

at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)

at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)

at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1354)

... 34 more

Caused by: java.sql.SQLException: No suitable driver found for jdbc:postgresql://198.81.158.57:5432/projectdev

at java.sql.DriverManager.getConnection(DriverManager.java:689)

at java.sql.DriverManager.getConnection(DriverManager.java:208)

at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)

at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)

... 38 more

#2

To resolve the issue, we modify the plugin "com.jaspersoft.studio.hibernate3_3.3.2.GA_01.jar".

Add the jdbc driver to lib directory (e.g. mysql-connector-java-5.1.25-bin.jar)
Update the META-INF/MANIFEST.MF in order to add the new jar file(s), the new classpath is:
Bundle-ClassPath: patch-library.jar,lib/ejb3-persistence.jar,lib/hiber
nate-annotations.jar,lib/hibernate-commons-annotations.jar,lib/hibern
ate3.jar,lib/javassist-3.9.0.GA.jar,lib/jta-1.1.jar,lib/mysql-connect
or-java-5.1.25-bin.jar,.

This solution is not a good solution since any Jasperstudio upgrade will force us to update the plugin.

Feedback