glassfish
  1. glassfish
  2. GLASSFISH-18430

Cluster commands fail if dcom dependencies removed

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.2_b23
    • Fix Version/s: None
    • Component/s: distributed management
    • Labels:
      None

      Description

      If I remove modules/j-interop-repackaged.jar from a GlassFish installation, then all cluster operations fail because the cluster admin module can't be loaded:

      $ ./asadmin list-instances
      Failed to start Bundle Id [178] State [INSTALLED] [org.glassfish.main.cluster.admin(Cluster Admin):3.1.2]
      Closest matching local and remote command(s):
      list-instances

      Command list-instances failed.

      j-interop-repackaged.jar needs to be a soft dependency where only the DCOM support stops working when it is removed.

        Activity

        Hide
        Joe Di Pol added a comment -

        I wonder if it is enough to update the metadata for cluster-common.jar so the Import-Package field specifies resolution="optional" for the interop packages like:

        Import-Package: ... org.jinterop.dcom.common;password=GlassFish;resolution:="optional"

        Show
        Joe Di Pol added a comment - I wonder if it is enough to update the metadata for cluster-common.jar so the Import-Package field specifies resolution="optional" for the interop packages like: Import-Package: ... org.jinterop.dcom.common;password=GlassFish;resolution:="optional"
        Hide
        Byron Nevins added a comment -

        Step #1

        I did this for 4.0 already. It should be repeated for 3.1.2 if back-porting is desired

        Move the dependency for the j-interop jar out of common/common-util

        Show
        Byron Nevins added a comment - Step #1 I did this for 4.0 already. It should be repeated for 3.1.2 if back-porting is desired Move the dependency for the j-interop jar out of common/common-util
        Hide
        Byron Nevins added a comment -

        AFAIK – there is one and only one way to do this with the j-interop jar:

        Reflection.

        The way I did it with DTrace was IMO an elegant solution.

        Create an interface-Contract (DTraceContract.java in glassfish-api)
        Implement the interface in value-add
        value-add uses reflection to access the actual DTrace code
        If there is no value-add, then the Habitat returns null with a call to getByContract()

        How to use this approach for DCOM:

        1) Create a glassfish public API, JinteropContract
        2) Implement the contract inside the j-interop-repackaged jar
        3) cluster/common now works exclusively with the Habitat-returned value from getByContract()
        4) if (3) is null – it simply errors out.

        Note: this is quite a bit of tricky work!

        Show
        Byron Nevins added a comment - AFAIK – there is one and only one way to do this with the j-interop jar: Reflection. The way I did it with DTrace was IMO an elegant solution. Create an interface-Contract (DTraceContract.java in glassfish-api) Implement the interface in value-add value-add uses reflection to access the actual DTrace code If there is no value-add, then the Habitat returns null with a call to getByContract() How to use this approach for DCOM: 1) Create a glassfish public API, JinteropContract 2) Implement the contract inside the j-interop-repackaged jar 3) cluster/common now works exclusively with the Habitat-returned value from getByContract() 4) if (3) is null – it simply errors out. Note: this is quite a bit of tricky work!
        Hide
        Byron Nevins added a comment -

        Progress:

        Now OSGi and Maven are perfectly happy if the j-interop-repackaged.jar isn't available.

        Next Step:
        If WIndows/Dcom code is called anyways – catch the NoClassDefFoundError and fail cleanly with a good message
        for the user.

        Show
        Byron Nevins added a comment - Progress: Now OSGi and Maven are perfectly happy if the j-interop-repackaged.jar isn't available. Next Step: If WIndows/Dcom code is called anyways – catch the NoClassDefFoundError and fail cleanly with a good message for the user.
        Hide
        Byron Nevins added a comment -

        I chose the non-reflection answer. I just tell OSGi that the jar is optional. You won't see an error until you try to load the Windows/Dcom class.

        Show
        Byron Nevins added a comment - I chose the non-reflection answer. I just tell OSGi that the jar is optional. You won't see an error until you try to load the Windows/Dcom class.
        Hide
        Byron Nevins added a comment -

        This jar file contains all the modified/new files for the svn revision # 52846 on the main trunk.

        It also has a diffs file.

        Show
        Byron Nevins added a comment - This jar file contains all the modified/new files for the svn revision # 52846 on the main trunk. It also has a diffs file.
        Hide
        Byron Nevins added a comment -

        Done!

        D:\gf\trunk\main\nucleus\cluster>svn commit
        Sending cluster\admin\src\main\java\com\sun\enterprise\v3\admin\cluster\ValidateDcom.java
        Sending cluster\common\osgi.bundle
        Sending cluster\common\pom.xml
        Adding cluster\common\src\main\java\com\sun\enterprise\util\cluster\windows\LocalStrings.properties
        Adding cluster\common\src\main\java\com\sun\enterprise\util\cluster\windows\SharedStrings.java
        Sending cluster\common\src\main\java\com\sun\enterprise\util\cluster\windows\io\WindowsRemoteFileSystem.java
        Sending cluster\common\src\main\java\com\sun\enterprise\util\cluster\windows\process\WindowsRemoteScripter.java
        Sending cluster\common\src\main\java\com\sun\enterprise\util\cluster\windows\process\WindowsWmi.java
        Transmitting file data ........
        Committed revision 52846.

        Show
        Byron Nevins added a comment - Done! D:\gf\trunk\main\nucleus\cluster>svn commit Sending cluster\admin\src\main\java\com\sun\enterprise\v3\admin\cluster\ValidateDcom.java Sending cluster\common\osgi.bundle Sending cluster\common\pom.xml Adding cluster\common\src\main\java\com\sun\enterprise\util\cluster\windows\LocalStrings.properties Adding cluster\common\src\main\java\com\sun\enterprise\util\cluster\windows\SharedStrings.java Sending cluster\common\src\main\java\com\sun\enterprise\util\cluster\windows\io\WindowsRemoteFileSystem.java Sending cluster\common\src\main\java\com\sun\enterprise\util\cluster\windows\process\WindowsRemoteScripter.java Sending cluster\common\src\main\java\com\sun\enterprise\util\cluster\windows\process\WindowsWmi.java Transmitting file data ........ Committed revision 52846.
        Hide
        Byron Nevins added a comment -

        BugDB: 13917303

        Show
        Byron Nevins added a comment - BugDB: 13917303
        Hide
        Byron Nevins added a comment -

        Ported to 3.1.2.1

        Show
        Byron Nevins added a comment - Ported to 3.1.2.1

          People

          • Assignee:
            Byron Nevins
            Reporter:
            Joe Di Pol
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: