NullPointerException within PdfPrinterRegistrationStartup.
I get a NullPointerExceptioon when I start my Riena based RCP application.
I tried to use the PdfViewerComposite. But I can not get it work.
The exception occured during the applications startup:
Mon Dec 07 15:00:56 CET 2009 ERROR Bundle org.eclipse.core.runtime Message: Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench"., Code: 2, Plugin: org.eclipse.ui.workbench
java.lang.NullPointerException
at org.nightlabs.eclipse.ui.pdfviewer.extension.printer.PdfPrinterRegistrationStartup.earlyStartup(PdfPrinterRegistrationStartup.java:21)
at org.eclipse.ui.internal.EarlyStartupRunnable.runEarlyStartup(EarlyStartupRunnable.java:87)
at org.eclipse.ui.internal.EarlyStartupRunnable.run(EarlyStartupRunnable.java:66)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.Workbench$55.run(Workbench.java:2192)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Mon Dec 07 15:00:56 CET 2009 ERROR Bundle org.eclipse.core.runtime Message: Unhandled Exception, Code: 4, Plugin: org.eclipse.ui
Mon Dec 07 15:00:56 CET 2009 ERROR Bundle org.eclipse.core.runtime Message: Unable to execute early startup code for an extension, Code: 0, Plugin: org.nightlabs.eclipse.ui.pdfviewer.extension
java.lang.NullPointerException
at org.nightlabs.eclipse.ui.pdfviewer.extension.printer.PdfPrinterRegistrationStartup.earlyStartup(PdfPrinterRegistrationStartup.java:21)
at org.eclipse.ui.internal.EarlyStartupRunnable.runEarlyStartup(EarlyStartupRunnable.java:87)
at org.eclipse.ui.internal.EarlyStartupRunnable.run(EarlyStartupRunnable.java:66)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.Workbench$55.run(Workbench.java:2192)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Hmmm, unfortunately, the line numbers don't match the source code version I have here :-( Thus, I'm not 100% sure, but I assume you don't have a Config in your application and it is a bug that this PdfPrinterRegistrationStartup does not check whether a Config exists.
You can solve the problem easily: In your Application.start() you should add sth. like this:
File configDir = new File(workspaceDir, ".config");
Config.createSharedInstance(new File(configDir, "config.xml"), true);
If you don't have a writable workspace directory, please let me know. Otherwise, this should solve the problem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
NullPointerException within PdfPrinterRegistrationStartup.
I get a NullPointerExceptioon when I start my Riena based RCP application.
I tried to use the PdfViewerComposite. But I can not get it work.
The exception occured during the applications startup:
Mon Dec 07 15:00:56 CET 2009 ERROR Bundle org.eclipse.core.runtime Message: Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench"., Code: 2, Plugin: org.eclipse.ui.workbench
java.lang.NullPointerException
at org.nightlabs.eclipse.ui.pdfviewer.extension.printer.PdfPrinterRegistrationStartup.earlyStartup(PdfPrinterRegistrationStartup.java:21)
at org.eclipse.ui.internal.EarlyStartupRunnable.runEarlyStartup(EarlyStartupRunnable.java:87)
at org.eclipse.ui.internal.EarlyStartupRunnable.run(EarlyStartupRunnable.java:66)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.Workbench$55.run(Workbench.java:2192)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Mon Dec 07 15:00:56 CET 2009 ERROR Bundle org.eclipse.core.runtime Message: Unhandled Exception, Code: 4, Plugin: org.eclipse.ui
Mon Dec 07 15:00:56 CET 2009 ERROR Bundle org.eclipse.core.runtime Message: Unable to execute early startup code for an extension, Code: 0, Plugin: org.nightlabs.eclipse.ui.pdfviewer.extension
java.lang.NullPointerException
at org.nightlabs.eclipse.ui.pdfviewer.extension.printer.PdfPrinterRegistrationStartup.earlyStartup(PdfPrinterRegistrationStartup.java:21)
at org.eclipse.ui.internal.EarlyStartupRunnable.runEarlyStartup(EarlyStartupRunnable.java:87)
at org.eclipse.ui.internal.EarlyStartupRunnable.run(EarlyStartupRunnable.java:66)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.Workbench$55.run(Workbench.java:2192)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
My Manifest File looks like:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Eclipse-BuddyPolicy: registered
Eclipse-RegisterBuddy: org.nightlabs.config
Bundle-Name: Reportview
Bundle-SymbolicName: com.inavare.extension.reportview;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.inavare.extension.reportview.Activator
Bundle-Vendor: INAVARE
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.inavare.extension.filter;bundle-version="1.0.0",
org.nightlabs.eclipse.ui.pdfviewer;bundle-version="0.9.6",
org.eclipse.birt.report.engine;bundle-version="2.3.2",
org.eclipse.birt.core.ui;bundle-version="2.3.2",
org.eclipse.ant.core;bundle-version="3.2.100",
org.eclipse.birt.report.engine.emitter.pdf;bundle-version="2.3.2",
org.eclipse.birt.report.engine.emitter.html;bundle-version="2.3.2",
org.eclipse.birt.report.viewer;bundle-version="2.3.2",
org.eclipse.birt.data;bundle-version="2.3.2",
org.nightlabs.base.ui;visibility:=reexport,
org.nightlabs.eclipse.ui.pdfviewer;visibility:=reexport,
org.apache.log4j;visibility:=reexport,
org.nightlabs.eclipse.ui.pdfviewer.extension;bundle-version="0.9.6"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: com.inavare.extension.reportview,
com.inavare.extension.reportview.generator,
com.inavare.extension.reportview.html,
com.inavare.extension.reportview.interfaces,
com.inavare.extension.reportview.pdf
Bundle-ClassPath: lib/com.inavare.tas.base.client-impl-2.1.5-SNAPSHOT.jar,
.
===
Hmmm, unfortunately, the line numbers don't match the source code version I have here :-( Thus, I'm not 100% sure, but I assume you don't have a Config in your application and it is a bug that this PdfPrinterRegistrationStartup does not check whether a Config exists.
You can solve the problem easily: In your Application.start() you should add sth. like this:
File configDir = new File(workspaceDir, ".config");
Config.createSharedInstance(new File(configDir, "config.xml"), true);
If you don't have a writable workspace directory, please let me know. Otherwise, this should solve the problem.
If you don't need the persistent configuration, you could create the config instance with a random folder in your temp-directory, too, of course.
Thanks for your great and fast help. It works now. My second posted
problem is solved too if the configuration path is set.
Great news! Congratulations!
I created a (https://sourceforge.net/tracker/?func=detail&aid=2910644&group_id=239428&atid=1109767).