Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDBC issue with OSGi runtime #787

Closed
wimjongman opened this issue Jan 24, 2022 · 9 comments
Closed

JDBC issue with OSGi runtime #787

wimjongman opened this issue Jan 24, 2022 · 9 comments

Comments

@wimjongman
Copy link
Contributor

wimjongman commented Jan 24, 2022

Originally posted by @hvbtup in #781 (comment)

Well, I tried to use the OSGI runtime in our application, but now I am facing a different issue.

If I understand correctly, in order to switch the application code from POJO to OSGI runtime, the following steps are necessary:

Download the OSGI runtime instead of the POJO runtime (of course).
The ZIP structure is basically the same, but the OSGI ZIP contains an additional folder ReportEngine\platform.

In the startup code, add a line

engineConfig.setBIRTHome(birt_home); 

where birt_home is the path to ReportEngine\platform
before calling

Platform.startup(engineConfig);

Without this modification the startup is not working.

Now I am facing this issue:

Cannot open the connection for the driver: org.eclipse.birt.report.data.oda.jdbc.
...
Caused by: org.eclipse.birt.report.data.oda.jdbc.JDBCException: Missing properties in Connection.open(Properties).
at org.eclipse.birt.report.data.oda.jdbc.Connection.open(Connection.java:134)
at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaConnection.open(OdaConnection.java:250)
at org.eclipse.birt.data.engine.odaconsumer.ConnectionManager.openConnection(ConnectionManager.java:153)
... 27 more

Note: My setup - which always worked with the POJO runtime so far - is as follows.

The reports are using an Oracle JDBC data source.
This data source definition is defined in a library lisa_basis.rptlibrary.
The reports (and all other libraries) are referencing the data source from the library.

The data source definition of lisa_basis.rptlibrary contains fake connection data, the actual properties are then supplied by the calling code as system properties when BIRT runtime is used - or as environment variables when the All-In-One designer is used:

grafik

grafik

lisa.getProperty(...) is defined in a *.js ressource and is just a thin wrapper around System.getProperty.

It seems that is no longer sufficient to have the ojdbc8.jar (Oracle JDBC driver) in the class path.
I also tried copying that file into ReportEngine\platform\plugins\org.eclipse.birt.report.data.oda.jdbc_4.9.0.v202201232020\drivers and specifying the path to that file in the appContext. The exception traceback stays the same.

Originally posted by @hvbtup in #781 (comment)

@wimjongman wimjongman changed the title Well, I tried to use the OSGI runtime in our application, but now I am facing a different issue. JDBC issue with OSGi runtime Jan 24, 2022
@wimjongman
Copy link
Contributor Author

@hvbtup Did you restart after adding the driver? Are you sure BIRT home is to the platform directory and not the one before?

@hvbtup
Copy link
Contributor

hvbtup commented Jan 24, 2022

2x yes

@wimjongman
Copy link
Contributor Author

Are all the properties set correctly? Please attach the stacktrace.

@wimjongman
Copy link
Contributor Author

Take a look at that Connection class starting from line 119. It is clear that it cannot find information in the connection properties.

@hvbtup
Copy link
Contributor

hvbtup commented Jan 24, 2022

The full stack trace:

org.eclipse.birt.report.engine.api.EngineException: An exception occurred during processing. Please see the following message for details:
Cannot open the connection for the driver: org.eclipse.birt.report.data.oda.jdbc.
org.eclipse.birt.report.data.oda.jdbc.JDBCException: Missing properties in Connection.open(Properties).
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1060)
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1045)
at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:84)
at org.eclipse.birt.report.engine.executor.GridItemExecutor.execute(GridItemExecutor.java:63)
at org.eclipse.birt.report.engine.executor.ReportExecutorUtil.executeAll(ReportExecutorUtil.java:73)
at org.eclipse.birt.report.engine.executor.ReportExecutorUtil.executeAll(ReportExecutorUtil.java:77)
at org.eclipse.birt.report.engine.executor.ReportExecutor.createPageExecutor(ReportExecutor.java:198)
at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplciateReportExecutor.createPageExecutor(SuppressDuplciateReportExecutor.java:57)
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportExecutor.createPageExecutor(WrappedReportExecutor.java:44)
at org.eclipse.birt.report.engine.executor.ReportExecutorUtil.executeMasterPage(ReportExecutorUtil.java:56)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.start(HTMLPageLM.java:132)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:85)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:96)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:144)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:68)
at com.tp.server.lisa.birt.report.BirtReportGenerator.run(BirtReportGenerator.java:433)
Caused by: org.eclipse.birt.report.data.adapter.api.AdapterException: An exception occurred during processing. Please see the following message for details:
Cannot open the connection for the driver: org.eclipse.birt.report.data.oda.jdbc.
org.eclipse.birt.report.data.oda.jdbc.JDBCException: Missing properties in Connection.open(Properties).
at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:585)
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:137)
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:249)
at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1628)
at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:73)
... 13 more
Caused by: org.eclipse.birt.data.engine.odaconsumer.OdaDataException: Cannot open the connection for the driver: org.eclipse.birt.report.data.oda.jdbc.
org.eclipse.birt.report.data.oda.jdbc.JDBCException: Missing properties in Connection.open(Properties).
at org.eclipse.birt.data.engine.odaconsumer.ExceptionHandler.newException(ExceptionHandler.java:50)
at org.eclipse.birt.data.engine.odaconsumer.ConnectionManager.openConnection(ConnectionManager.java:162)
at org.eclipse.birt.data.engine.executor.DataSource.newConnection(DataSource.java:201)
at org.eclipse.birt.data.engine.executor.DataSource.open(DataSource.java:190)
at org.eclipse.birt.data.engine.impl.DataSourceRuntime.openOdiDataSource(DataSourceRuntime.java:191)
at org.eclipse.birt.data.engine.impl.QueryExecutor.openDataSource(QueryExecutor.java:412)
at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecution(QueryExecutor.java:297)
at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare(PreparedQuery.java:378)
at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.produceQueryResults(PreparedDataSourceQuery.java:156)
at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute(PreparedDataSourceQuery.java:145)
at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.execute(PreparedOdaDSQuery.java:160)
at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:572)
... 17 more
Caused by: org.eclipse.birt.report.data.oda.jdbc.JDBCException: Missing properties in Connection.open(Properties).
at org.eclipse.birt.report.data.oda.jdbc.Connection.open(Connection.java:134)
at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaConnection.open(OdaConnection.java:250)
at org.eclipse.birt.data.engine.odaconsumer.ConnectionManager.openConnection(ConnectionManager.java:153)
... 27 more

The same code in the same environment works if I change the flollowing:

  • Don't set BIRT_HOME
  • Use the POJO runtime (from the hvbtup/birt (flugtiger_master) instead of the OSGI runtime from eclipse/birt
  • Use Java 8 instead of 11

So yes, the properties are correct.

@hvbtup
Copy link
Contributor

hvbtup commented Jan 24, 2022

@wimjongman Do you have an Oracle DB at hand? If yes, I can try to create a stand-alone test case, though this will cost me several hours of work.

@wimjongman
Copy link
Contributor Author

No, I don't have that.

@hvbtup
Copy link
Contributor

hvbtup commented Jan 24, 2022

Sorry, it was my fault.

I forgot to copy one of our JARs to the ReportEngine/lib directory.
This caused the logic in the data source property bindings to "think" that the report is running in the all-in-one designer and thus expecting the properties as environment variables instead of system properties, resulting in null properties.

So this is issue can be closed.
The effort was not in vain, though, because in my comments I described the tiny changes that are necessary to migrate a POJO runtime program to an OSGI runtime program ;-)

BTW, when I captured stderr, I found that the OSGI runtime produces lots of error messages on startup as described here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=547526

In my case they are looking like this:

org.eclipse.equinox.internal.p2.extensionlocation.SiteListener@666f4066: java.lang.UnsupportedOperationException: Not able to create StateObjectFactory implementation: org.eclipse.osgi.internal.resolver.StateObjectFactoryImpl.

I have no idea what these messages mean and why there are so many of them.

@wimjongman
Copy link
Contributor Author

wimjongman commented Jan 24, 2022

BTW, when I captured stderr, I found that the OSGI runtime produces lots of error messages on startup as described here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=547526

In my case they are looking like this:

org.eclipse.equinox.internal.p2.extensionlocation.SiteListener@666f4066: java.lang.UnsupportedOperationException: Not able to create StateObjectFactory implementation: org.eclipse.osgi.internal.resolver.StateObjectFactoryImpl.

I have no idea what these messages mean and why there are so many of them.

That is another issue (see #835).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants