error.CannotStartupOSGIPlatform: Null pointer ServiceLAuncher

naina007
edited February 11, 2022 in Analytics #1
<p>Hello.</p>
<p>I am getting the following error while the platform.startup gets called. </p>
<p> </p>
<p>I am using. Neon Eclipse: <span style="font-family:Monaco;font-size:11px;">Version: Neon.3 Release (4.6.3)</span></p>
<p><span style="font-family:Monaco;font-size:11px;">Birt Runtime: birt 4.6.0</span></p>
<p> </p>
<p><span style="font-family:Monaco;font-size:11px;">Birt Jars has been added in  the classpath entry for the class that runs it as java application. </span></p>
<p> </p>
<p>
</p>
<p class=""><span>org.eclipse.birt.core.exception.BirtException</span><span>: error.CannotStartupOSGIPlatform</span></p>
<p class=""> </p>
<p class=""> </p>
<p class=""><span>Caused by: </span><span>java.lang.NullPointerException</span></p>
<p class="">at org.eclipse.birt.core.framework.jar.ServiceLauncher.startup(<span>ServiceLauncher.java:51</span>)</p>
<p class="">at org.eclipse.birt.core.framework.Platform.startup(<span>Platform.java:75</span>)</p>
<p class=""> </p>
<p class=""><span style="color:#000000;">Any help would be really appreciated.</span></p>
<p class=""> </p>
<p class=""><span style="color:#000000;">I looked around the form and having hard time finding related to ServiceLauncher Null pointer application.</span></p>
<p class=""> </p>
<p class=""> </p>
<p class=""><span style="color:#000000;">Thank you,</span></p>
<p class=""><span style="color:#000000;">Naina</span></p>

Comments

  • Zorawar
    edited June 6, 2017 #2
    <p>Share some details of how the project is setup and how the BIRT runtime jars are used.</p>
    <p>Also what kind of a project it is?</p>
    <p>And more specifically, how does the project have the dependency on BIRT runtime jars ?</p>
    <p> </p>
    <p>Seems like the class is/was loaded by the bootstrap classloader and so results in the null pointer exception.</p>
    <p>To resolve that the jars would need to available on the classpath and be loaded by a classloader other than the bootstrap one.</p>
    <p> </p>
    <p>If the project is an Eclipse Java project then add the jars as external jars (Build Path > Configure Build Path... ) and the exception will go away.</p>
    <p> </p>
    <p>On a side note, I am curious how you are using 4.6 BIRT runtime as it is unusable without the workaround in this bug <a data-ipb='nomediaparse' href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=497356'>https://bugs.eclipse.org/bugs/show_bug.cgi?id=497356</a>.</p&gt;
  • <p>Thank you for the reply. </p>
    <p>I will try answering the questions in bullet points. </p>
    <p> </p>
    <p>1. It is a Eclipse Java Project.</p>
    <p>2. I created a user library to add all the jars in the Java Build Path. </p>
    <p>3. I run my reports using a Java class ( main method)</p>
    <p>4. Tried adding the jars in the User Entries under the Classpath of the Runtime Configuration. still same error.</p>
    <p>5. Even tried adding all the Birt Jars in the Jre/Lib folder.  still same error . ( it is boggling me as to how is it not finding the jars)</p>
    <p>6. I was using 4.5 and trying to migrate to 4.6 birt runtime.</p>
    <p>7. I do not use Web Viewer, I create EXCEL and PDF reports . </p>
    <p>8. Looked at the class file ServiceLauncher.java. The null pointer occurs when it is trying to load the MANIFEST.MF file</p>
    <p> </p>
    <p>Please let me know if more information is needed. </p>
    <p> </p>
    <p>I really do appreciate the reply. </p>
    <p> </p>
    <p>At this point I am thinking back to getting lower version of Eclipse. </p>
    <p> </p>
    <p>Thank you,</p>
  • Zorawar
    edited June 13, 2017 #4
    <p>Do not add the jars as a User Library and do not put them in the jre/lib folder. Doing that results in the classes being loaded by the bootstrap classloader and so it results in the null pointer exception. The reason for this is, calling <span style="font-family:'courier new', courier, monospace;">getClassLoader()</span> on a class loaded by bootstrap classloader returns null. </p>
    <p><a data-ipb='nomediaparse' href='https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getClassLoader--'>https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getClassLoader--</a></p&gt;
    <p> </p>
    <p>Remove the User Library and remove the jars from the jre/lib folder.</p>
    <p> </p>
    <p>Now add the jars as mentioned earlier.</p>
    <p>1. Right-click on the project and navigate, <strong>Build Path</strong> > <strong>Configure Build Path...</strong></p>
    <p>2. Then under the <strong>Libraries tab</strong>, select <strong>Add External JARs</strong>. Navigate to the BIRT runtime SDK folder that has all the jars and add them.</p>
    <p>Alternatively, if you place all <strong>jars required by BIRT under a lib folder in your project</strong> then you can <strong>select Add JARs</strong> and add them. See what works best for your situation.</p>
    <p> </p>
    <p>The exception should go away now.</p>
  • <p>Thank you for the reply and I apologize for the delay. </p>
    <p> </p>
    <p>And, I never realized this about BootStrap ClassLoader. So, I really appreciate it. </p>
    <p> </p>
    <p>Back to the problem, I tried adding the jars mentioned in the option 1. and I get. </p>
    <p>ClassNotFound exception for IRenderOption. ( Tried doing it both ways) This Class not found error only goes away if I add the jars to BootStrap ClassLoader.</p>
    <p> </p>
    <p>However, there is no issue when I use 4.5 version of BIRT Runtime. That is leading me to believe that something is not stable in version 4.6 yet. :)</p>
    <p> </p>
    <p>Thank you for your time. I really appreciate it. </p>
  • Zorawar
    edited June 18, 2017 #6
    <p>The problem seems to be with the runtime jar.</p>
    <p>1. Open the jar, org.eclipse.birt.runtime_4.6.0-20160607.jar</p>
    <p>2. Navigate to META-INF folder under it.</p>
    <p>3. Remove the two files, ECLIPSE_.RSA and ECLIPSE_.SF, from META-INF folder.</p>
    <p> </p>
    <p>Use a utility like 7zip to remove the selected files from the runtime jar as shown in the linked image.</p>
    <p><a class="" href="http://developer.actuate.com/community/forum/index.php?/files/download/1140-modify-birt-runtime-artifact-4-6png/">http://developer.actuate.com/community/forum/index.php?/files/download/1140-modify-birt-runtime-artifact-4-6png/</a></p&gt;
    <p> </p>
    <p>