Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » NullPointerException Platform.createFactoryObject(NullPointerException, sample,)
NullPointerException Platform.createFactoryObject [message #778328] Thu, 12 January 2012 12:05 Go to next message
Michal Sz is currently offline Michal SzFriend
Messages: 2
Registered: January 2012
Junior Member
Eclipse Java EE IDE for Web Developers.
Version: Indigo Service Release 1
Build id: 20110916-0149
Birt 3.7.1

I've got java.lang.NullPointerException on:
  engine = factory.createReportEngine( config );
//...and then second one at line:
 design = engine.openReportDesign("C:/Users/ms/Libs/BIRT/birt-runtime-3_7_1/ReportEngine/samples/hello_world.rptdesign"); 


I believe it's connected with:

IReportEngineFactory factory = (IReportEngineFactory) Platform
    .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY ); //


I've commented
//  Platform.startup( config );


but it didn't help.
any ideas, please?
Re: NullPointerException Platform.createFactoryObject [message #778411 is a reply to message #778328] Thu, 12 January 2012 16:12 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Leave the Platform.startup. Are you setting a birt home? If so remove
it. 3.7.1 does not use this variable.

Jason

On 1/12/2012 7:05 AM, Michal Sz wrote:
> Eclipse Java EE IDE for Web Developers.
> Version: Indigo Service Release 1
> Build id: 20110916-0149
> Birt 3.7.1
>
> I've got java.lang.NullPointerException on:
>
> engine = factory.createReportEngine( config );
> //...and then second one at line:
> design =
> engine.openReportDesign("C:/Users/ms/Libs/BIRT/birt-runtime-3_7_1/ReportEngine/samples/hello_world.rptdesign");
>
>
> I believe it's connected with:
>
>
> IReportEngineFactory factory = (IReportEngineFactory) Platform
> .createFactoryObject(
> IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY ); //
>
>
> I've commented // Platform.startup( config );
>
> but it didn't help.
> any ideas, please?
Re: NullPointerException Platform.createFactoryObject [message #779653 is a reply to message #778411] Mon, 16 January 2012 09:02 Go to previous messageGo to next message
Michal Sz is currently offline Michal SzFriend
Messages: 2
Registered: January 2012
Junior Member
but if I leave
  Platform.startup( config );


I receive:
Quote:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/CoreException
at org.eclipse.birt.core.framework.Platform.createPlatformLauncher(Platform.java:115)
at org.eclipse.birt.core.framework.Platform.startup(Platform.java:74)
at testBirtEngine.TestBirtEngine.executeReport(TestBirtEngine.java:41)
at testBirtEngine.TestBirtEngine.main(TestBirtEngine.java:124)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.CoreException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more


//sorry for delay in communication

Ok, I've found Your solution for that issue - I havent't linked all jars from Engine folder. I cannot give a link to that topic so I'll just said thanks a lot!

[Updated on: Mon, 16 January 2012 09:11]

Report message to a moderator

Re: NullPointerException Platform.createFactoryObject [message #780379 is a reply to message #779653] Tue, 17 January 2012 17:32 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Do you have all the libs from the reportengine/lib directory in your
classpath? How are you running this? As a simple Java app?

Jason


On 1/16/2012 4:02 AM, Michal Sz wrote:
> but if I leave Platform.startup( config );
>
> I receive:
> Quote:
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org/eclipse/core/runtime/CoreException
>> at
>> org.eclipse.birt.core.framework.Platform.createPlatformLauncher(Platform.java:115)
>>
>> at org.eclipse.birt.core.framework.Platform.startup(Platform.java:74)
>> at testBirtEngine.TestBirtEngine.executeReport(TestBirtEngine.java:41)
>> at testBirtEngine.TestBirtEngine.main(TestBirtEngine.java:124)
>> Caused by: java.lang.ClassNotFoundException:
>> org.eclipse.core.runtime.CoreException
>> at java.net.URLClassLoader$1.run(Unknown Source)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at java.net.URLClassLoader.findClass(Unknown Source)
>> at java.lang.ClassLoader.loadClass(Unknown Source)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>> at java.lang.ClassLoader.loadClass(Unknown Source)
>> ... 4 more
>
Re: NullPointerException Platform.createFactoryObject [message #780501 is a reply to message #780379] Wed, 18 January 2012 10:45 Go to previous messageGo to next message
Deepali Patil is currently offline Deepali PatilFriend
Messages: 22
Registered: January 2012
Junior Member
I also have same problem.
I am using Linux-mint
I have set BIRT_HOME=/home/developer/Birt/birt-runtime-3_7_0/ReportEngine

public File generateReport(
final Map<String, String> reportParameters,
final int reportId, final String outputFormat) {
IReportRunnable design = null;
try {
if(null!=dao) {
design = reportEngine.openReportDesign(
reportDesignFolderResolver.getFolder().getAbsolutePath()+
File.separatorChar +
dao.get((long)reportId).getName());
} else {
return null;
}
}catch (Exception e) {
logger.error(e.getMessage(),e);

}
////..............///
return new File(outputFile);
}

I got this exception,

java.lang.NullPointerException
at org.eclipse.birt.report.engine.api.ReportEngine.openReportDesign(ReportEngine.java:126)
at com.sne.reportRunner.reportCreator.ReportGeneratorImpl.generateReport(ReportGeneratorImpl.java:51)
at com.sne.reportRunner.reportCreator.ReportGeneratorImplTest.testThatReportInExcelFormatFileIsGenerated(ReportGeneratorImplTest.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
Re: NullPointerException Platform.createFactoryObject [message #780609 is a reply to message #780501] Wed, 18 January 2012 18:34 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

With 3.7 do not set BIRT_HOME. Just add the jars to your classpath and
do a platform startup. In 3.7.2 we will most likely offer a POJO
runtime and an OSGi runtime to allow you to choose the way you want to
run BIRT.

Jason

On 1/18/2012 5:45 AM, Deepali Patil wrote:
> I also have same problem.
> I am using Linux-mint
> I have set BIRT_HOME=/home/developer/Birt/birt-runtime-3_7_0/ReportEngine
>
> public File generateReport(
> final Map<String, String> reportParameters,
> final int reportId, final String outputFormat) {
> IReportRunnable design = null;
> try {
> if(null!=dao) {
> design = reportEngine.openReportDesign(
> reportDesignFolderResolver.getFolder().getAbsolutePath()+
> File.separatorChar +
> dao.get((long)reportId).getName());
> } else {
> return null;
> }
> }catch (Exception e) {
> logger.error(e.getMessage(),e);
>
> }
> ////..............///
> return new File(outputFile);
> }
>
> I got this exception,
>
> java.lang.NullPointerException
> at
> org.eclipse.birt.report.engine.api.ReportEngine.openReportDesign(ReportEngine.java:126)
>
> at
> com.sne.reportRunner.reportCreator.ReportGeneratorImpl.generateReport(ReportGeneratorImpl.java:51)
>
> at
> com.sne.reportRunner.reportCreator.ReportGeneratorImplTest.testThatReportInExcelFormatFileIsGenerated(ReportGeneratorImplTest.java:80)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>
> at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>
> at
> org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
>
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
> at
> org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
>
> at
> org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
>
> at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
>
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
> at
> org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
>
> at
> org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
>
> at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
> at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
>
> at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>
> at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
>
>
Re: NullPointerException Platform.createFactoryObject [message #780693 is a reply to message #780609] Thu, 19 January 2012 05:23 Go to previous messageGo to next message
Deepali Patil is currently offline Deepali PatilFriend
Messages: 22
Registered: January 2012
Junior Member
Thanks for the quick reply. I still have a few more doubts.
Please help me resolve them. I have been struggling with them for a while now.

On Linux-I added all jars in jvm/lib/ext folder it works as expected in eclipse, but if I run this through maven it gives same error again. I have set CLASSPATH=BIRT_HOME\lib\*.jar


and in windows-by adding jar's in classpath it neither works in eclipse nor in maven.

on my machine (windows) without adding jars in classpath code is working in eclipse as well with maven, I have set BIRT_HOME=E:\Programs\birt-runtime-3_7_0\ReportEngine only.
same I am trying on another windows machine gives same error.

What is platform startup?

Just a brief about how we installed BIRT.
We installed BIRT from Eclipse -> Install new software from the url download.eclipse.org/releases/galileo

then I downloaded the BIRT runtime 3.7.0 and copied this jar files in jvm/lib/ext

Please help me resolve the issue.
Re: NullPointerException Platform.createFactoryObject [message #780879 is a reply to message #780693] Thu, 19 January 2012 18:58 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I would not copy the birt jars to jvm/lib/ext. Also with 3.7 runtime
download do not set a birt home. Just add the jars from the
reportengine/lib directory to the classpath.

Jason

On 1/19/2012 12:23 AM, Deepali Patil wrote:
> Thanks for the quick reply. I still have a few more doubts.
> Please help me resolve them. I have been struggling with them for a
> while now.
>
> On Linux-I added all jars in jvm/lib/ext folder it works as expected in
> eclipse, but if I run this through maven it gives same error again. I
> have set CLASSPATH=BIRT_HOME\lib\*.jar
>
>
> and in windows-by adding jar's in classpath it neither works in eclipse
> nor in maven.
>
> on my machine (windows) without adding jars in classpath code is working
> in eclipse as well with maven, I have set
> BIRT_HOME=E:\Programs\birt-runtime-3_7_0\ReportEngine only.
> same I am trying on another windows machine gives same error.
>
> What is platform startup?
>
> Just a brief about how we installed BIRT.
> We installed BIRT from Eclipse -> Install new software from the url
> download.eclipse.org/releases/galileo
>
> then I downloaded the BIRT runtime 3.7.0 and copied this jar files in
> jvm/lib/ext
>
> Please help me resolve the issue.
Re: NullPointerException Platform.createFactoryObject [message #782161 is a reply to message #780879] Mon, 23 January 2012 09:30 Go to previous messageGo to next message
Deepali Patil is currently offline Deepali PatilFriend
Messages: 22
Registered: January 2012
Junior Member
Thanks for the response,
I copied all jars in classpath, it works in eclipse. Though my ultimate goal is to make it work in maven. I am not able to find maven dependency for birt report.
Please help me to resolve this. Also if you could tell me the link from where I can download all the dependencies.
Re: NullPointerException Platform.createFactoryObject [message #782397 is a reply to message #782161] Mon, 23 January 2012 16:40 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

We are still working on this. Have a look at this thread that lists a
snapshot:

http://www.birt-exchange.org/org/forum/index.php/topic/24196-mavenizing-birt-3-7-1/

Jason

On 1/23/2012 4:30 AM, Deepali Patil wrote:
> Thanks for the response,
> I copied all jars in classpath, it works in eclipse. Though my ultimate
> goal is to make it work in maven. I am not able to find maven dependency
> for birt report.
> Please help me to resolve this. Also if you could tell me the link from
> where I can download all the dependencies.
Re: NullPointerException Platform.createFactoryObject [message #783120 is a reply to message #782397] Wed, 25 January 2012 05:11 Go to previous messageGo to next message
Deepali Patil is currently offline Deepali PatilFriend
Messages: 22
Registered: January 2012
Junior Member
Thank you very much,

The dependencies given on
http:www.birt-exchange.org/org/forum/index.php/topic/24196-mavenizing-birt-3-7-1/
this link working for me,

thanks once again.
Re: NullPointerException Platform.createFactoryObject [message #900151 is a reply to message #783120] Sat, 04 August 2012 17:56 Go to previous messageGo to next message
Omer Akhter is currently offline Omer AkhterFriend
Messages: 4
Registered: August 2012
Junior Member
Hi

I am new to BIRT. I am using BIRT 4.2

I am facing similar problem. I have a maven project. My BIRT dependency looks like this:

<dependency>
	<groupId>org.eclipse.birt.runtime</groupId>
	<artifactId>org.eclipse.birt.runtime</artifactId>
	<version>4.2.0</version>
</dependency>


And when I run my application through eclipse, it works fine.

But when I creat a jar with dependencies using maven-assembly-plugin and try to run it. The createFactoryObject returns null.

Any help ...?

Thanks
Re: NullPointerException Platform.createFactoryObject [message #1755168 is a reply to message #900151] Tue, 28 February 2017 16:55 Go to previous messageGo to next message
Peter Devnull is currently offline Peter DevnullFriend
Messages: 1
Registered: February 2017
Junior Member
Hi

I am facing the same problem as Omer Akhter.

Using

<dependency>
	    <groupId>org.eclipse.birt.runtime</groupId>
	    <artifactId>org.eclipse.birt.runtime</artifactId>
	    <version>4.4.2</version>
</dependency>


this	||    ServicePlatform  (id=5854)	  ||    org.eclipse.birt.core.framework.jar.ServicePlatform@182c76d4

	bundles	||    HashMap<K,V>  (id=5864)	  ||    {}

	config	||    EngineConfig  (id=5806)	  ||    EngineConfig: logDest=<null>;logLevel=FINEST;org.eclipse.birt.report.engine.api.EngineConfig.emitterConfigs={html=org.eclipse.birt.report.engine.api.HTMLEmitterConfig@4cd58747};

	extensionRegistry	 ||   ExtensionRegistry  (id=5865)	||     org.eclipse.birt.core.framework.jar.ExtensionRegistry@40105b00

	workspace	||   File  (id=5867)      	||     C:\Users\myUSER\AppData\Local\Temp\workspace_764553c5-5f25-41f3-8b1b-cbe0565c504f

extensionId	    ||       "org.eclipse.birt.report.engine.ReportEngineFactory" (id=5839)	    ||      org.eclipse.birt.report.engine.ReportEngineFactory



->

defaultRegistryProvider	   ||    ServiceLauncher$1  (id=5902)	      ||     org.eclipse.birt.core.framework.jar.ServiceLauncher$1@5f679d27


The createFactoryObject method returns null.

Years passed since Omer asked for help. Maybe this time some can help.

Thanks
Re: NullPointerException Platform.createFactoryObject [message #1796674 is a reply to message #1755168] Wed, 17 October 2018 10:41 Go to previous message
Yue Clemes is currently offline Yue ClemesFriend
Messages: 2
Registered: August 2015
Junior Member
Same problem when I creat a fatjar with dependencies via gradle

Any help plz :(
Previous Topic:Factory is null
Next Topic:Unknown system variable 'OPTION'
Goto Forum:
  


Current Time: Tue Apr 23 11:48:57 GMT 2024

Powered by FUDForum. Page generated in 0.04842 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top