Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351052 - org.eclipse.core.runtime.CoreException when restarting the ReportEngine
Summary: org.eclipse.core.runtime.CoreException when restarting the ReportEngine
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 minor with 1 vote (vote)
Target Milestone: 4.3.0 RC1   Edit
Assignee: Birt-ReportEngine-inbox@eclipse.org CLA
QA Contact: Xiaoying Gu CLA
URL:
Whiteboard:
Keywords:
: 412103 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-04 03:38 EDT by David / Hanh Do Minh CLA
Modified: 2013-07-09 03:50 EDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David / Hanh Do Minh CLA 2011-07-04 03:38:33 EDT
Build Identifier: birt-runtime-3_7_0

After restarting the reporting engine in a JUnit test, the following exceptions occur:
java.lang.RuntimeException: java.lang.RuntimeException: org.eclipse.birt.core.exception.BirtException: error.CannotStartupOSGIPlatform
Caused by: org.eclipse.birt.core.exception.BirtException: error.CannotStartupOSGIPlatform
	at org.eclipse.birt.core.framework.Platform.startup(Platform.java:81)
	... 28 more
Caused by: org.eclipse.birt.core.framework.FrameworkException: Cant register the ExtensionRegistry classpath
	at org.eclipse.birt.core.framework.jar.ServiceLauncher.startup(ServiceLauncher.java:99)
	at org.eclipse.birt.core.framework.Platform.startup(Platform.java:75)
	... 29 more
Caused by: org.eclipse.core.runtime.CoreException: Extension registry provider is already set.
	at org.eclipse.core.internal.registry.RegistryProviderFactory.setDefault(RegistryProviderFactory.java:31)
	at org.eclipse.core.runtime.RegistryFactory.setDefaultRegistryProvider(RegistryFactory.java:129)
	at org.eclipse.birt.core.framework.jar.ServiceLauncher.startup(ServiceLauncher.java:84)
	... 30 more

The workaround is to add RegistryProviderFactory.releaseDefault();
when shutting down the engine

Reproducible: Always

Steps to Reproduce:
EngineConfig engineConfig = new EngineConfig();
Platform.startup(engineConfig);

IReportEngineFactory reportEngineFactory = (IReportEngineFactory) Platform
					.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
			reportEngine = reportEngineFactory.createReportEngine(engineConfig);

...
Comment 1 Jan Inowolski CLA 2011-10-22 19:51:29 EDT
I can reproduce it on Linux, on BIRT 3.7.0.

Workaround works, thanks david :) .

Should "RegistryProviderFactory.releaseDefault();" be written somewhere in the BIRT cleanup code?
Comment 2 edward zambrano CLA 2012-05-30 01:02:56 EDT
Hi,

Could you please tell what to add to my java code to fix this?

My code goes like this 
...

           task.run();
                task.close();
                engine.destroy();
            } catch (Exception ex) {
                ex.printStackTrace();
            } finally {
                Platform.shutdown();
            }
..

I don't know how to put the "RegistryProviderFactory.releaseDefault()"...thanks for your help
Comment 3 David / Hanh Do Minh CLA 2012-05-30 02:11:48 EDT
This is how I used it:

engine.destroy();
Platform.shutdown();
RegistryProviderFactory.releaseDefault();
engine = null;

(In reply to comment #2)
> Hi,
> 
> Could you please tell what to add to my java code to fix this?
> 
> My code goes like this 
> ...
> 
>            task.run();
>                 task.close();
>                 engine.destroy();
>             } catch (Exception ex) {
>                 ex.printStackTrace();
>             } finally {
>                 Platform.shutdown();
>             }
> ..
> 
> I don't know how to put the "RegistryProviderFactory.releaseDefault()"...thanks
> for your help
Comment 4 edward zambrano CLA 2012-05-30 22:45:42 EDT
Problem solved!

It worked like you said, but first I had to import the Class using
"import org.eclipse.core.internal.registry.RegistryProviderFactory;"

(In reply to comment #3)
> This is how I used it:
> 
> engine.destroy();
> Platform.shutdown();
> RegistryProviderFactory.releaseDefault();
> engine = null;
> 
> (In reply to comment #2)
> > Hi,
> > 
> > Could you please tell what to add to my java code to fix this?
> > 
> > My code goes like this 
> > ...
> > 
> >            task.run();
> >                 task.close();
> >                 engine.destroy();
> >             } catch (Exception ex) {
> >                 ex.printStackTrace();
> >             } finally {
> >                 Platform.shutdown();
> >             }
> > ..
> > 
> > I don't know how to put the "RegistryProviderFactory.releaseDefault()"...thanks
> > for your help
Comment 5 Xiaoying Gu CLA 2012-05-31 01:40:27 EDT
Set this bug as worksforme based on comment #3
Comment 6 Jan Inowolski CLA 2012-05-31 05:30:11 EDT
But it was only a workaround. It is not mentioned in a documentation, e.g. http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php#reportengine or Integrating and Extending book. 

Should it be at least documented or fixed?
Comment 7 Jason Weathersby CLA 2012-06-01 17:23:43 EDT
Changes made to:
http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.php#reportengine

Jason
Comment 8 Sibusiso Nkambule CLA 2012-10-03 05:24:07 EDT
Eclipse doesn't find the class RegistryProviderFactory, which jar contains this class?

(In reply to comment #3)
> This is how I used it:
> 
> engine.destroy();
> Platform.shutdown();
> RegistryProviderFactory.releaseDefault();
> engine = null;
> 
> (In reply to comment #2)
> > Hi,
> > 
> > Could you please tell what to add to my java code to fix this?
> > 
> > My code goes like this 
> > ...
> > 
> >            task.run();
> >                 task.close();
> >                 engine.destroy();
> >             } catch (Exception ex) {
> >                 ex.printStackTrace();
> >             } finally {
> >                 Platform.shutdown();
> >             }
> > ..
> > 
> > I don't know how to put the "RegistryProviderFactory.releaseDefault()"...thanks
> > for your help
Comment 9 edward zambrano CLA 2012-10-03 10:47:00 EDT
You must add all the jars from the lib directory of the eclipse runtime folder to your project.


(In reply to comment #8)
> Eclipse doesn't find the class RegistryProviderFactory, which jar contains
> this class?
> 
> (In reply to comment #3)
> > This is how I used it:
> > 
> > engine.destroy();
> > Platform.shutdown();
> > RegistryProviderFactory.releaseDefault();
> > engine = null;
> > 
> > (In reply to comment #2)
> > > Hi,
> > > 
> > > Could you please tell what to add to my java code to fix this?
> > > 
> > > My code goes like this 
> > > ...
> > > 
> > >            task.run();
> > >                 task.close();
> > >                 engine.destroy();
> > >             } catch (Exception ex) {
> > >                 ex.printStackTrace();
> > >             } finally {
> > >                 Platform.shutdown();
> > >             }
> > > ..
> > > 
> > > I don't know how to put the "RegistryProviderFactory.releaseDefault()"...thanks
> > > for your help
Comment 10 Xiaoying Gu CLA 2012-10-09 22:24:58 EDT
Reopen for enhancement.
Comment 11 Sibusiso Nkambule CLA 2012-10-23 06:15:52 EDT
Hi there..

I tried it but din't work for me. I am using birt-runtime-3_7_2..

This is the error i am getting 


Caused by: org.eclipse.birt.core.exception.BirtException: error.CannotStartupOSGIPlatform
	at org.eclipse.birt.core.framework.Platform.startup(Platform.java:81)
	at momentum.wealth.wlisp.report.birt.engine.core.BirtEngineFactory.getObject(BirtEngineFactory.java:50)
	... 104 more
Caused by: org.eclipse.birt.core.framework.FrameworkException: Cant register the ExtensionRegistry classpath
	at org.eclipse.birt.core.framework.jar.ServiceLauncher.startup(ServiceLauncher.java:99)
	at org.eclipse.birt.core.framework.Platform.startup(Platform.java:75)
	... 105 more
Caused by: org.eclipse.core.runtime.CoreException: Extension registry provider is already set.
	at org.eclipse.core.internal.registry.RegistryProviderFactory.setDefault(RegistryProviderFactory.java:31)
	at org.eclipse.core.runtime.RegistryFactory.setDefaultRegistryProvider(RegistryFactory.java:126)
	at org.eclipse.birt.core.framework.jar.ServiceLauncher.startup(ServiceLauncher.java:84)
	... 106 more
Comment 12 Gang Liu CLA 2013-05-08 01:58:32 EDT
fixed
Comment 13 Gang Liu CLA 2013-07-09 03:50:26 EDT
*** Bug 412103 has been marked as a duplicate of this bug. ***