glassfish
  1. glassfish
  2. GLASSFISH-18345

Invalid OSGi web fragment missing Bundle-Manifest corrupts glassfish installation

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Duplicate
    • Affects Version/s: 3.1.2_b19, 3.1.2_b20
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Windows 7 64-bit

      java version "1.6.0_29"
      Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
      Oracle JRockit(R) (build R28.2.0-79-146777-1.6.0_29-20111005-1808-windows-x86_64, compiled mode)

      Description

      I was trying to follow the tutorial from the section named "4.6 Static Resources and WAB" to deploy host.war and fragment.jar to Glassfish 3.1.2b19/20 from here:

      http://glassfish.java.net/public/GF-OSGi-Features.pdf

      I found out that I was able to corrupt the entire installation by simply adding fragment.jar to the autodeploy\bundle folder.

      By tailing the logs you can see that it installed ok:

      [#|2012-02-07T11:14:36.857-0600|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=17;_ThreadName=Thread-4;|Installed C:\dev\java\tools\glassfish-3.1.2-b20\glassfish3\glassfish\domains\domain1\autodeploy\bundles\fragment.jar|#]

      But if you stop the domain and restart it results in the following error below. Removing fragment.jar DOES NOT fix the problem either. I had to install a fresh copy of glassfish to get back a working server.

      Adding host.war by itself was fine. It's after adding fragment.jar where the corruption happens. Before the restart the server seems to work ok (one.html and two.jsp are still served up) although I never got the fragment.jar (bar/three.html results in 404) to be recognized. Adding the fragment.jar to the WAR without the OSGi headers it works ok. Trying to use it as a OSGi fragment is where the problem occurs.

      C:\dev\java\tools>glassfish-3.1.2-b20\glassfish3\bin\asadmin start-domain
      Waiting for domain1 to start ..Error starting domain domain1.
      The server exited prematurely with exit code 1.
      Before it died, it produced the following output:

      Launching GlassFish on Felix platform
      ERROR: Bundle org.glassfish.main.javaee-api.javax.annotation [1] Error starting file:/C:/dev/java/tools/glassfish-3.1.2-
      b20/glassfish3/glassfish/modules/endorsed/javax.annotation.jar (java.lang.NullPointerException)
      ERROR: Bundle jaxb-api [2] Error starting file:/C:/dev/java/tools/glassfish-3.1.2-b20/glassfish3/glassfish/modules/endor
      sed/jaxb-api-osgi.jar (java.lang.NullPointerException)
      ERROR: Bundle org.glassfish.metro.webservices-api-osgi [3] Error starting file:/C:/dev/java/tools/glassfish-3.1.2-b20/gl
      assfish3/glassfish/modules/endorsed/webservices-api-osgi.jar (java.lang.NullPointerException)
      ERROR: Bundle org.glassfish.main.core.glassfish [101] Error starting file:/C:/dev/java/tools/glassfish-3.1.2-b20/glassfi
      sh3/glassfish/modules/glassfish.jar (java.lang.NullPointerException)
      ERROR: Bundle org.glassfish.hk2.osgi-adapter [203] Error starting file:/C:/dev/java/tools/glassfish-3.1.2-b20/glassfish3
      /glassfish/modules/osgi-adapter.jar (java.lang.NullPointerException)
      [WARN ][jrockit] PermSize=64m ignored: Not a valid option for JRockit
      [WARN ][jrockit] MaxPermSize=192m ignored: Not a valid option for JRockit
      [WARN ][jrockit] NewRatio=2 ignored: Not a valid option for JRockit
      java.lang.NullPointerException
      at org.apache.felix.framework.StatefulResolver$ResolverStateImpl.getCandidates(StatefulResolver.java:1263)
      at org.apache.felix.framework.resolver.Candidates.populateFragmentOndemand(Candidates.java:347)
      at org.apache.felix.framework.resolver.Candidates.populate(Candidates.java:148)
      at org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:115)
      at org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:168)
      at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3819)
      at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
      at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
      at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
      at java.lang.Thread.run(Thread.java:662)
      java.lang.NullPointerException
      at org.apache.felix.framework.StatefulResolver$ResolverStateImpl.getCandidates(StatefulResolver.java:1263)
      at org.apache.felix.framework.resolver.Candidates.populateFragmentOndemand(Candidates.java:347)
      at org.apache.felix.framework.resolver.Candidates.populate(Candidates.java:148)
      at org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:115)
      at org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:168)
      at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3819)
      at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
      at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
      at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
      at java.lang.Thread.run(Thread.java:662)
      java.lang.NullPointerException
      at org.apache.felix.framework.StatefulResolver$ResolverStateImpl.getCandidates(StatefulResolver.java:1263)
      at org.apache.felix.framework.resolver.Candidates.populateFragmentOndemand(Candidates.java:347)
      at org.apache.felix.framework.resolver.Candidates.populate(Candidates.java:148)
      at org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:115)
      at org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:168)
      at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3819)
      at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
      at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
      at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
      at java.lang.Thread.run(Thread.java:662)
      java.lang.NullPointerException
      at org.apache.felix.framework.StatefulResolver$ResolverStateImpl.getCandidates(StatefulResolver.java:1263)
      at org.apache.felix.framework.resolver.Candidates.populateFragmentOndemand(Candidates.java:347)
      at org.apache.felix.framework.resolver.Candidates.populate(Candidates.java:148)
      at org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:115)
      at org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:168)
      at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3819)
      at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
      at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
      at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
      at java.lang.Thread.run(Thread.java:662)
      java.lang.NullPointerException
      at org.apache.felix.framework.StatefulResolver$ResolverStateImpl.getCandidates(StatefulResolver.java:1263)
      at org.apache.felix.framework.resolver.Candidates.populateFragmentOndemand(Candidates.java:347)
      at org.apache.felix.framework.resolver.Candidates.populate(Candidates.java:148)
      at org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:115)
      at org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:168)
      at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3819)
      at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
      at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
      at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
      at java.lang.Thread.run(Thread.java:662)
      Exception in thread "Main Thread" java.lang.reflect.InvocationTargetException
      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 com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
      at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55)
      Caused by: org.glassfish.embeddable.GlassFishException: org.glassfish.embeddable.GlassFishException: No GlassFishRuntime
      available
      at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.build(OSGiGlassFishRuntimeBuilder.jav
      a:164)
      at org.glassfish.embeddable.GlassFishRuntime._bootstrap(GlassFishRuntime.java:157)
      at org.glassfish.embeddable.GlassFishRuntime.bootstrap(GlassFishRuntime.java:110)
      at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:112)
      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 com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:98)
      at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:56)
      Caused by: org.glassfish.embeddable.GlassFishException: No GlassFishRuntime available
      at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.getGlassFishRuntime(OSGiGlassFishRunt
      imeBuilder.java:202)
      at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntimeBuilder.build(OSGiGlassFishRuntimeBuilder.jav
      a:162)
      ... 9 more
      Error stopping framework: java.lang.NullPointerException
      java.lang.NullPointerException
      at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher$1.run(GlassFishMain.java:203)

      Command start-domain failed.

        Activity

        Hide
        blackbeltdev added a comment -

        Sorry I wasn't sure how to make sure you got my feedback so I cloned this issue. I was hoping to change the description...

        I would say at a minimum this is a documentation issue because I was following the example from

        http://glassfish.java.net/public/GF-OSGi-Features.pdf

        which did NOT have the Bundle-Manifest header in the fragment example:

        4.6 Static Resources and WAB

        fragment.jar/
        META-INF/
        resources/
        bar/
        three.html
        four.jsp
        MANIFEST.MF
        MANIFEST.MF contains:
        Bundle-SymbolicName: fragment
        Fragment-Host: host

        However I would also like to point out that removing ALL the bundles from autodeploy folder and trying to restart glassfish it would NOT start.

        I understand the root cause may lie with Felix but IMHO Oracle should devote resources to correct that issue ASAP. A single misconfigured Fragment should not kill the entire installation.

        This looks really bad from a marketing aspect for glassfish which we are considering purchasing commerical support.

        Show
        blackbeltdev added a comment - Sorry I wasn't sure how to make sure you got my feedback so I cloned this issue. I was hoping to change the description... I would say at a minimum this is a documentation issue because I was following the example from http://glassfish.java.net/public/GF-OSGi-Features.pdf which did NOT have the Bundle-Manifest header in the fragment example: 4.6 Static Resources and WAB fragment.jar/ META-INF/ resources/ bar/ three.html four.jsp MANIFEST.MF MANIFEST.MF contains: Bundle-SymbolicName: fragment Fragment-Host: host However I would also like to point out that removing ALL the bundles from autodeploy folder and trying to restart glassfish it would NOT start. I understand the root cause may lie with Felix but IMHO Oracle should devote resources to correct that issue ASAP. A single misconfigured Fragment should not kill the entire installation. This looks really bad from a marketing aspect for glassfish which we are considering purchasing commerical support.
        Hide
        Sanjeeb Sahoo added a comment -

        Hi,

        Thanks for reporting the original issue. I have checked in a new version of the pdf document after correcting the bundle manifest.

        The simple workaround to the problem is to remove the rogue fragment jar from the system and remove (rm -rf) osgi-cache located in glassfish/domains/domain1/osgi-cache. You don't have to reinstall glassfish. GlassFish will start fine after this.

        Just in case you don't know, the primary committer in Apache Felix is an Oracle GlassFish Engineer called Richard S Hall. I have already filed the bug against Felix and it will get fixed. We will definitely integrate it as we always do.

        Sahoo

        Show
        Sanjeeb Sahoo added a comment - Hi, Thanks for reporting the original issue. I have checked in a new version of the pdf document after correcting the bundle manifest. The simple workaround to the problem is to remove the rogue fragment jar from the system and remove (rm -rf) osgi-cache located in glassfish/domains/domain1/osgi-cache. You don't have to reinstall glassfish. GlassFish will start fine after this. Just in case you don't know, the primary committer in Apache Felix is an Oracle GlassFish Engineer called Richard S Hall. I have already filed the bug against Felix and it will get fixed. We will definitely integrate it as we always do. Sahoo
        Hide
        blackbeltdev added a comment -

        Awesome. Thanks Sahoo!

        Show
        blackbeltdev added a comment - Awesome. Thanks Sahoo!

          People

          • Assignee:
            Sanjeeb Sahoo
            Reporter:
            blackbeltdev
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: