Jump to content
We've recently updated our Privacy Statement, available here ×

iReport 4.7.0 with Hibernate 4


suikast42

Recommended Posts

We will migrate our reporting from BIRT to Jaspersoft. Because with iRport I can use hibernate as datasource. This is not so easy with birt.

So the problem is iReport us the hibernate version 3.1.0 and we allways thze build in version in the latest jboss release. Actually also 4.0.1 (Jboss 7.1.1.Final ) or 4.1.5 (Jboss 7.1.2.Final). 

For this purpose I replace the hibernate libs in <iReportHome>reportmodulesext with the latest.

This are:

  • antlr-2.7.7.jar
  • dom4j-1.6.1.jar
  • hibernate-commons-annotations-4.0.1.Final.jar
  • hibernate-core-4.1.5.SP1.jar
  • hibernate-jpa-2.0-api-1.0.1.Final.jar
  • javassist-3.15.0-GA.jar
  • jboss-logging-3.1.0.GA.jar
  • jboss-transaction-api_1.1_spec-1.0.0.Final.jar

 

Now if I test the connextion I got the Exception shown below:

java.lang.NoClassDefFoundError: org/hibernate/cfg/AnnotationConfiguration
        at com.jaspersoft.ireport.designer.connection.JRHibernateConnection.getSessionFactory(JRHibernateConnection.java:128)
        at com.jaspersoft.ireport.designer.connection.JRHibernateConnection$1.run(JRHibernateConnection.java:157)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:705)
        at java.awt.EventQueue.access$000(EventQueue.java:101)
        at java.awt.EventQueue$3.run(EventQueue.java:666)
        at java.awt.EventQueue$3.run(EventQueue.java:664)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:675)
        at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:121)
        at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:182)
        at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:221)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:219)
        at java.awt.Dialog.show(Dialog.java:1072)
        at java.awt.Component.show(Component.java:1651)
        at java.awt.Component.setVisible(Component.java:1603)
        at java.awt.Window.setVisible(Window.java:1013)
        at java.awt.Dialog.setVisible(Dialog.java:1003)
        at com.jaspersoft.ireport.designer.connection.gui.ConnectionsDialog.jButtonModifyParameterActionPerformed(ConnectionsDialog.java:540)
        at com.jaspersoft.ireport.designer.connection.gui.ConnectionsDialog.jTableParametersMouseClicked(ConnectionsDialog.java:461)
        at com.jaspersoft.ireport.designer.connection.gui.ConnectionsDialog.access$300(ConnectionsDialog.java:47)
        at com.jaspersoft.ireport.designer.connection.gui.ConnectionsDialog$6.mouseClicked(ConnectionsDialog.java:202)
        at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270)
        at java.awt.Component.processMouseEvent(Component.java:6508)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
        at java.awt.Component.processEvent(Component.java:6270)
        at java.awt.Container.processEvent(Container.java:2229)
        at java.awt.Component.dispatchEventImpl(Component.java:4861)
        at java.awt.Container.dispatchEventImpl(Container.java:2287)
        at java.awt.Component.dispatchEvent(Component.java:4687)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4501)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
        at java.awt.Container.dispatchEventImpl(Container.java:2273)
        at java.awt.Window.dispatchEventImpl(Window.java:2713)
        at java.awt.Component.dispatchEvent(Component.java:4687)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
        at java.awt.EventQueue.access$000(EventQueue.java:101)
        at java.awt.EventQueue$3.run(EventQueue.java:666)
        at java.awt.EventQueue$3.run(EventQueue.java:664)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
        at java.awt.EventQueue$4.run(EventQueue.java:680)
        at java.awt.EventQueue$4.run(EventQueue.java:678)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
        at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:121)
        at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:182)
        at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:221)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:219)
        at java.awt.Dialog.show(Dialog.java:1072)
        at java.awt.Component.show(Component.java:1651)
        at java.awt.Component.setVisible(Component.java:1603)
        at java.awt.Window.setVisible(Window.java:1013)
        at java.awt.Dialog.setVisible(Dialog.java:1003)
        at com.jaspersoft.ireport.designer.connection.gui.ConnectionsDialog.setVisible(ConnectionsDialog.java:651)
        at com.jaspersoft.ireport.designer.menu.DatasourcesAction.performAction(DatasourcesAction.java:46)
        at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:118)
        at org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(ActionsBridge.java:77)
        at org.openide.util.actions.CallableSystemAction.actionPerformed(CallableSystemAction.java:114)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
        at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
        at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
        at java.awt.Component.processMouseEvent(Component.java:6505)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
        at org.openide.awt.ToolbarButton.processMouseEvent(ToolbarButton.java:61)
        at java.awt.Component.processEvent(Component.java:6270)
        at java.awt.Container.processEvent(Container.java:2229)
        at java.awt.Component.dispatchEventImpl(Component.java:4861)
        at java.awt.Container.dispatchEventImpl(Container.java:2287)
        at java.awt.Component.dispatchEvent(Component.java:4687)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
        at java.awt.Container.dispatchEventImpl(Container.java:2273)
        at java.awt.Window.dispatchEventImpl(Window.java:2713)
        at java.awt.Component.dispatchEvent(Component.java:4687)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
        at java.awt.EventQueue.access$000(EventQueue.java:101)
        at java.awt.EventQueue$3.run(EventQueue.java:666)
        at java.awt.EventQueue$3.run(EventQueue.java:664)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
        at java.awt.EventQueue$4.run(EventQueue.java:680)
        at java.awt.EventQueue$4.run(EventQueue.java:678)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
        at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.ClassNotFoundException: org.hibernate.cfg.AnnotationConfiguration
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:252)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        ... 111 more
 

It seems so that the libraries don't loaded. Must I register this somewhere ??

 

Thanks in advance.



Post Edited by suikast42 at 08/11/2012 15:30
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi guys,

As I read this, http://community.jaspersoft.com/questions/521095/will-you-update-hibernate-support, I thought "super it should be easy". As we know the devil is allways plugged in detail ;).

I download netbeans IDE then checkout iReport from source and bind the platform for iReport. So I 'm able to compile and build iRerport from source.

Remove the jars from the dependencies of ireport-designer listed below:

  • ejb3-persistence.jar
  • hibernate3.jar
  • hibernate-annotations.jar
  • hibernate-common-annotations.jar
  • jpa.jar
  • jta.jar

Update the jars from the dependencies of ireport-designer listed below:

  • antlr-2.7.6.jar --> 2.7.7
  • dom4j-1.6.jar --> 1.6.1
  • javaassist-3.4.GA.jar --> 3.15

New the jars from the dependencies of ireport-designer listed below:

  • ojdbc.jar ( jdbc driver for oracle)
  • hibernate-commons-annotations-4.0.1.Final.jar
  • hibernate-core-4.1.5.SP1.jar
  • hibernate-jpa-2.0-api-1.0.1.Final.jar
  • jboss-logging-3.1.0.GA.jar
  • jboss-transaction-api_1.1_spec-1.0.0.Final.jar
  • hibernate-envers-4.1.5.SP1.jar
  • hibernate-entitymanager-4.1.5.SP1.jar

After refresh the workspace surprise surprise. Many things are not compatible with hibernate 3.

  1. Reorganize imports for hibernate Session. Package is changed,
  2. HibernateConnectionProvider must implement three new methods.
  3. JRHibernateConnection must be refactored: The method getSessionFactory shoulde be configure in this way: Otherwise HibernateConnectionProvider.configure will not be triggered.

 

public SessionFactory getSessionFactory() throws org.hibernate.HibernateException {

 if (useAnnotations)

{

 Configuration conf = new org.hibernate.cfg.Configuration().configure();

ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(conf.getProperties()).buildServiceRegistry();

 conf.setProperty(Environment.CONNECTION_PROVIDER, "com.jaspersoft.ireport.designer.connection.HibernateConnectionProvider");

 return conf.buildSessionFactory(serviceRegistry);

}else{

return new Configuration().configure().buildSessionFactory(); // I hjave no testmodel for this but this should be refactored too

}

 

4. Hibernate datatypes packes is changed.

So I can do a query witth hql now. I can see the fileds of my entity but no results. I get the Exception which is shown below:

Set Dataset: net.sf.jasperreports.engine.design.JRDesignDataset@118a554
Setting divider at 508
- HHH000043: Configuring from resource: /hibernate.cfg.xml
- HHH000040: Configuration resource: /hibernate.cfg.xml
- HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
- HHH000041: Configured SessionFactory: null
- HHH000402: Using Hibernate built-in connection pool (not for production use!)
- HHH000115: Hibernate connection pool size: 20
- HHH000006: Autocommit mode: false
- HHH000401: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@localhost:1521:XE]
- HHH000046: Connection properties: {user=ops$wan, password=****}
- HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
- HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
- HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory
- HHH000397: Using ASTQueryTranslatorFactory
 Populating preview...
net.sf.jasperreports.engine.design.JRValidationException: Report design not valid :
         1. java.lang.ClassNotFoundException: [L;
        at net.sf.jasperreports.engine.design.JRAbstractCompiler.verifyDesign(JRAbstractCompiler.java:271)
        at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:153)
        at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:240)
        at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:490)
        at com.jaspersoft.ireport.designer.data.ReportQueryDialog.populateDataPreview(ReportQueryDialog.java:2246)
        at com.jaspersoft.ireport.designer.data.ReportQueryDialog.access$3100(ReportQueryDialog.java:104)
        at com.jaspersoft.ireport.designer.data.ReportQueryDialog$32.run(ReportQueryDialog.java:2135)
        at java.lang.Thread.run(Thread.java:722)
 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...