glassfish
  1. glassfish
  2. GLASSFISH-18333

OSGi web fragment example corrupts glassfish installation

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Invalid
    • Affects Version/s: 3.1.2_dev
    • 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 -

        Here are the sample projects using Gradle.

        Show
        blackbeltdev added a comment - Here are the sample projects using Gradle.
        Hide
        blackbeltdev added a comment -

        Here's the non-OSGi fragment version which works. You have to build fragment project first and then host project.

        Show
        blackbeltdev added a comment - Here's the non-OSGi fragment version which works. You have to build fragment project first and then host project.
        Hide
        blackbeltdev added a comment -

        Same issue on 3.1.2-b21

        Show
        blackbeltdev added a comment - Same issue on 3.1.2-b21
        Hide
        blackbeltdev added a comment -

        Here's a WAB that contains single servlet that is using multiple OSGi fragments (ResourceBundles for each language) that works fine.

        I wonder if this is only an issue with pure static only fragments????

        Show
        blackbeltdev added a comment - Here's a WAB that contains single servlet that is using multiple OSGi fragments (ResourceBundles for each language) that works fine. I wonder if this is only an issue with pure static only fragments????
        Hide
        Sanjeeb Sahoo added a comment -

        There is a problem with the fragment bundle. It does not have Bundle-ManifestVersion set to 2. Fragment bundles are an OSGi R4 concept, so they must be marked as an R4 bundle by having the following header in them:
        Bundle-ManifestVersion: 2

        When I update fragment.jar with the above header, everything works.

        I understand the software should be more resilient, but the issue in the underlying platform. See [1].

        [1] https://issues.apache.org/jira/browse/FELIX-3343

        Show
        Sanjeeb Sahoo added a comment - There is a problem with the fragment bundle. It does not have Bundle-ManifestVersion set to 2. Fragment bundles are an OSGi R4 concept, so they must be marked as an R4 bundle by having the following header in them: Bundle-ManifestVersion: 2 When I update fragment.jar with the above header, everything works. I understand the software should be more resilient, but the issue in the underlying platform. See [1] . [1] https://issues.apache.org/jira/browse/FELIX-3343
        Hide
        Sanjeeb Sahoo added a comment -

        Closing as Invalid as opposed to "Won't fix"

        Show
        Sanjeeb Sahoo added a comment - Closing as Invalid as opposed to "Won't fix"

          People

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

            Dates

            • Created:
              Updated:
              Resolved: