Unable to access connection profile from Resources if Datasource created dynamically in beforeFactor

If I create datasource from predefined profile, it looks account profile first in Resource file; that is ihub default behavior
.... local.acconnprofiles
but if I create dynamically inside beforeFactory method, It is unable to found file from Resource
var connectionProfilePath = "**local.acconnprofiles";
is not working but If I give full absolute path, it is working

function refreshMap() {
var connectionProfilePath = "c:\temp\local.acconnprofiles";

out.println(".........connectionProfilePath "+connectionProfilePath)
var dataSource = new OdaDataSourceDesign("EC JDBC Data Source");
dataSource.setExtensionID("org.eclipse.birt.report.data.oda.jdbc");
dataSource.addPublicProperty("OdaConnProfileName", "EC JDBC Data Source");
dataSource.addPublicProperty("OdaConnProfileStorePath", connectionProfilePath);

var dataSet = new OdaDataSetDesign("Refresh Map")
dataSet.setDataSource(dataSource.getName());
dataSet.setQueryText("REFRESH MAP");

var config = reportContext.getReportRunnable().getReportEngine().getConfig();

var dataEngine = DataEngine.newDataEngine(config, null);
dataEngine.defineDataSource(dataSource);
dataEngine.defineDataSet(dataSet);

var queryDefinition = new QueryDefinition();
queryDefinition.setDataSetName(dataSet.getName());
dataEngine.prepare(queryDefinition).execute(null);

}

refreshMap();

.....................error
Thread 68, 2353] 2019-11-27 10:47:04 UTC+0530 org.eclipse.datatools.connectivity.oda.profile.provider.ProfilePropertyProviderImpl.resolveRelativePath()
WARNING: No ResourceIdentifiers is available in the appContext to resolve the connection profile store file’s relative path (ExperienceCenter.acconnprofiles).
[Thread 68, 2353] 2019-11-27 10:47:04 UTC+0530 org.eclipse.birt.data.engine.odaconsumer.ConnectionManager.openConnection()
SEVERE: Unable to open connection.org.eclipse.birt.report.data.oda.jdbc.JDBCException: Missing properties in Connection.open(Properties). ;
org.eclipse.datatools.connectivity.oda.OdaException: Unable to find or access the named profile (EC JDBC Data Source) in profile store path (E). ;
org.eclipse.datatools.connectivity.oda.OdaException ;
java.net.MalformedURLException: no protocol: ExperienceCenter.acconnprofiles
at org.eclipse.birt.report.data.oda.jdbc.Connection.open(Connection.java:160)
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:439)
at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecution(QueryExecutor.java:327)
at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare(PreparedQuery.java:464)
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:179)
at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute(PreparedDataSourceQuery.java:159)
at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute(PreparedDataSourceQuery.java:142)
at sun.reflect.GeneratedMethodAccessor712.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
at org.mozilla.javascript.gen._report_method__name__initialize___1542._c_refreshMap_1(/report/method[@name="initialize"]:49)
at org.mozilla.javascript.gen._report_method__name__initialize___1542.call(/report/method[@name="initialize"])
at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:74)
at org.mozilla.javascript.gen._report_method__name__initialize___1542._c_script_0(/report/method[@name="initialize"]:52)
at org.mozilla.javascript.gen._report_method__name__initialize___1542.call(/report/method[@name="initialize"])
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
at org.mozilla.javascript.gen._report_method__name__initialize___1542.call(/report/method[@name="initialize"])
at org.mozilla.javascript.gen._report_method__name__initialize___1542.exec(/report/method[@name="initialize"])
at org.eclipse.birt.report.engine.javascript.JavascriptEngine.evaluate(JavascriptEngine.java:291)
at org.eclipse.birt.core.script.ScriptContext.evaluate(ScriptContext.java:159)
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:791)
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:720)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.handleScriptInternal(ScriptExecutor.java:118)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.handleScript(ScriptExecutor.java:105)
at org.eclipse.birt.report.engine.script.internal.ReportScriptExecutor.handleInitialize(ReportScriptExecutor.java:84)
at org.eclipse.birt.report.engine.api.impl.EngineTask.loadDesign(EngineTask.java:1975)
at org.eclipse.birt.report.engine.api.impl.RenderTask.render(RenderTask.java:296)
at com.actuate.birt.report.engine.internal.ActuateRenderTask.render(ActuateRenderTask.java:63)
at com.actuate.reportapi.engine.birt.ViewReportTask.renderReport(ViewReportTask.java:1855)
at com.actuate.reportapi.engine.birt.ViewReportTask.doTask(ViewReportTask.java:426)
at com.actuate.reportapi.engine.Task.execute(Task.java:340)
at com.actuate.reportapi.enginemanager.ControlRunnable.runTask(ControlRunnable.java:84)
at com.actuate.reportapi.enginemanager.ControlRunnable.run(ControlRunnable.java:38)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Comments

Sign In or Register to comment.