Error while previewing birt report in eclipse report designer

747 views Asked by At

I'm trying to preview a report in a newer version of eclipse with Jboss tools installed and I'm getting the following error. My report uses a hibernate datasource.

Eclipse - kepler Jboss Tools version 4.1.2

Caused by: java.lang.NoClassDefFoundError: org/hibernate/HibernateException
at       org.jboss.tools.birt.oda.impl.ConsoleConfigurationOdaFactory.getSessionFactory(ConsoleConfigurationOdaFactory.java:54)
   at org.jboss.tools.birt.oda.impl.ConsoleConfigurationOdaFactory.(ConsoleConfigurationOdaFactory.java:34)
   at org.jboss.tools.birt.oda.impl.HibernateConnection.open(HibernateConnection.java:47)
   at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaConnection.open(OdaConnection.java:250)
   at org.eclipse.birt.data.engine.odaconsumer.ConnectionManager.openConnection(ConnectionManager.java:165)
   at org.eclipse.birt.data.engine.executor.DataSource.newConnection(DataSource.java:224)
   at org.eclipse.birt.data.engine.executor.DataSource.open(DataSource.java:212)
   at org.eclipse.birt.data.engine.impl.DataSourceRuntime.openOdiDataSource(DataSourceRuntime.java:217)
   at org.eclipse.birt.data.engine.impl.QueryExecutor.openDataSource(QueryExecutor.java:435)
   at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecution(QueryExecutor.java:322)
   at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare(PreparedQuery.java:463)
   at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.produceQueryResults(PreparedDataSourceQuery.java:190)
   at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute(PreparedDataSourceQuery.java:178)
   at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.execute(PreparedOdaDSQuery.java:178)
   at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:637)
   at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:158)
   at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:275)
   at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1947)
   at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80)
   at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:62)
   at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43)
   at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
   at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34)
   at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
   at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
   at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
   at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
   at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
   at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
   at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
   at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
   at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
   at org.eclipse.birt.report.engine.layout.html.HTMLRepeatHeaderLM.layoutChildren(HTMLRepeatHeaderLM.java:46)
   at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
   at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
   at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
   at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
   at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:181)
... 59 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.HibernateException cannot be found by org.jboss.tools.birt.oda_1.2.0.v20110809
   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:358)
... 97 more


Just to give more context,

We are in the process of migrating our application from Jboss 5 to Jboss EAP 6.3. In our older application, we have birt reports which run on birt version 2.3.2 and we are trying to upgrade them to newer version and try to get them running in our application. As a start, I tried testing them with standalone birt.war application in the following environment.

Hibernate 4.3.1

Jboss Tools - 4.1.2

Eclipse Kepler - 4.3

Birt Version - 3.7.2/4.2.2/4.3.2/4.4.0

The report has a hibernate data source defined and all the data sets are defined using this hibernate data source config. The related data source has also been defined in the jboss eap runtime. With all the setup complete, I deployed birt.war runtime on jboss and tried accessing the report with correct parameters. I keep getting this error, every time i try running the report either using standalone birt.war or in my Eclipse report designer.

org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report.
   at    org.eclipse.birt.report.service.ReportEngineService.throwDummyException(ReportEngineService.java:1115)
   at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:943)
   at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(BirtViewerReportService.java:973)
   at org.eclipse.birt.report.service.actionhandler.BirtGetPageAllActionHandler.__execute(BirtGetPageAllActionHandler.java:131)
   at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
   at org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(AbstractBaseDocumentProcessor.java:47)
   at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(AbstractBaseComponentProcessor.java:143)
   at org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleGetPageAll(BirtDocumentProcessor.java:183)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(AbstractBaseComponentProcessor.java:112)
   at org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(BirtSoapBindingImpl.java:66)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
   at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
   at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
   at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
   at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
   at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
   at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
   at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:265)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
   at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
   at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
  at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
   at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
   at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
   at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
   at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:386)
   at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
   at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
   at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:229)
   at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
   at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
   at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
   at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
   at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
   at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
   at org.eclipse.jetty.server.Server.handle(Server.java:370)
   at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
   at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
   at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
   at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
   at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
   at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
   at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
   at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
   at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
   at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
   at java.lang.Thread.run(Thread.java:745)
Caused by: org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
   at org.eclipse.birt.report.engine.api.impl.EngineTask.handleFatalExceptions(EngineTask.java:2380)
   at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:191)
   at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
   at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:937)
... 57 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/HibernateException
   at org.jboss.tools.birt.oda.impl.ConsoleConfigurationOdaFactory.getSessionFactory(ConsoleConfigurationOdaFactory.java:56)
   at org.jboss.tools.birt.oda.impl.ConsoleConfigurationOdaFactory.(ConsoleConfigurationOdaFactory.java:34)
   at org.jboss.tools.birt.oda.impl.HibernateConnection.open(HibernateConnection.java:47)
   at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaConnection.open(OdaConnection.java:250)
   at org.eclipse.birt.data.engine.odaconsumer.ConnectionManager.openConnection(ConnectionManager.java:165)
   at org.eclipse.birt.data.engine.executor.DataSource.newConnection(DataSource.java:224)
   at org.eclipse.birt.data.engine.executor.DataSource.open(DataSource.java:212)
   at org.eclipse.birt.data.engine.impl.DataSourceRuntime.openOdiDataSource(DataSourceRuntime.java:217)
   at org.eclipse.birt.data.engine.impl.QueryExecutor.openDataSource(QueryExecutor.java:435)
   at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecution(QueryExecutor.java:322)
   at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare(PreparedQuery.java:463)
   at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.produceQueryResults(PreparedDataSourceQuery.java:190)
   at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute(PreparedDataSourceQuery.java:178)
   at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.execute(PreparedOdaDSQuery.java:178)
   at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:637)
   at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:158)
   at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:275)
   at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1947)
   at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80)
   at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:62)
   at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43)
   at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)
   at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34)
   at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
   at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
   at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
   at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
   at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
   at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
   at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
   at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
   at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
   at org.eclipse.birt.report.engine.layout.html.HTMLRepeatHeaderLM.layoutChildren(HTMLRepeatHeaderLM.java:46)
   at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
   at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
   at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
   at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
   at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:181)
... 59 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.HibernateException cannot be found by org.jboss.tools.birt.oda_1.2.0.v20110809
   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:358)
... 97 more

Any thoughts on why this is happening and how to get around this problem are helpful.

Thanks.

1

There are 1 answers

2
Aaron Digulla On

Try to add Hibernate to the classpath of your (report) project.

Longer explanation. BIRT doesn't talk to data bases directly. Instead, it relies on "Open Data Access" from the Data Tools Platform project.

DTP offers a wide range of connectors to databases, web services, REST services, you name it. For some of them, ODA comes with everything necessary to connect to the service. But for many, you need to provide additional JARs (like JDBC drivers).

Hibernate is a special case. To use it, you need to add the Hibernate classes to the classpath (BIRT will add all Java code found in the report project to the classpath).

For details, this forum post contains points on various ways to use BIRT with Hibernate: https://www.eclipse.org/forums/index.php/t/169623/

[EDIT] Your exception stack trace contains an interesting details:

Caused by: java.lang.ClassNotFoundException: org.hibernate.HibernateException cannot be found by org.jboss.tools.birt.oda_1.2.0.v20110809
   at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)

That means OSGi is trying to load the class which will fail since Hibernate isn't an Eclipse bundle. You could now create a bundle from the JAR and add that to the classpath but that probably will break something else since you'll end up with two Hibernate's on the classpath loaded from different classloaders.

I think you need to try to tell BIRT that hibernate*.jar is a JDBC driver. In the dialog where you can manage JDBC drivers, you need to select the JAR for your database plus the Hibernate JAR(s).