glassfish
  1. glassfish
  2. GLASSFISH-16493

Unable to deploy an application containing appclients into GlassFish running in non-OSGi mode.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 3.1.1_b10, 4.0
    • Component/s: deployment
    • Labels:
      None
    • Environment:

      Any

      Description

      When an application that contains appclients is deployed to the GlassFish running in non-OSGi (Static) mode, it fails with "org.glassfish.deployment.common.DeploymentException: /org/glassfish/appclient/client/AppClientFacade.class"

      To reproduce:

      1. Start GlassFish in static mode : cd $GF_INSTALL/modules; java -DGlassFish_Platform=Static -jar glassfish.jar

      2. Deploy the attached ear file : asadmin deploy ejb-bmp-enrollerApp.ear

      You will see the error as attached in the error.log.txt.

      Since Embedded GlassFish runs in static mode, issue GLASSFISH-16430 has dependency on this fix. Hence marking it as Critical.

        Issue Links

          Activity

          Hide
          Bhavanishankar added a comment -

          Sample EAR file containing an appclient module.
          Error log when deployed on static mode GlassFish.

          Show
          Bhavanishankar added a comment - Sample EAR file containing an appclient module. Error log when deployed on static mode GlassFish.
          Hide
          Bhavanishankar added a comment -

          I did some investigation on this, and found that a '/' character was prefixed while loading AppClientFacade.class. So, the resource path was "/org/glassfish/appclient/client/AppClientFacade.class".

          This is fine in OSGi mode, because the bundle classloader is able to look up the resource whether the path has '/' prefix or not.

          But since the static GlassFish is loaded using URLClassloader, the lookup of the resource whose path is prefixed with '/' fails. (thats how the URL classloaders work).

          The following simple change fixes the issue, and it works fine in both OSGi and Non-OSGi modes:

          Index: server/core/src/main/java/org/glassfish/appclient/server/core/AppClientDeployerHelper.java
          ===================================================================
          — server/core/src/main/java/org/glassfish/appclient/server/core/AppClientDeployerHelper.java (revision 46414)
          +++ server/core/src/main/java/org/glassfish/appclient/server/core/AppClientDeployerHelper.java (working copy)
          @@ -521,7 +521,7 @@
          private void copyClass(final WritableArchive facadeArchive,
          final String classResourcePath) throws IOException {
          OutputStream os = facadeArchive.putNextEntry(classResourcePath);

          • InputStream is = openByteCodeStream("/" + classResourcePath);
            + InputStream is = openByteCodeStream(classResourcePath);

          copyStream(is, os);
          try {
          Index: server/core/src/main/java/org/glassfish/appclient/server/core/AppClientGroupFacadeGenerator.java
          ===================================================================
          — server/core/src/main/java/org/glassfish/appclient/server/core/AppClientGroupFacadeGenerator.java (revision 46414)
          +++ server/core/src/main/java/org/glassfish/appclient/server/core/AppClientGroupFacadeGenerator.java (working copy)
          @@ -261,7 +261,7 @@
          OutputStream os = facadeArchive.putNextEntry(mainClassResourceName);

          try

          { - InputStream is = openByteCodeStream("/" + mainClassResourceName); + InputStream is = openByteCodeStream(mainClassResourceName); AppClientDeployerHelper.copyStream(is, os); is.close(); }

          catch (Exception e) {

          Show
          Bhavanishankar added a comment - I did some investigation on this, and found that a '/' character was prefixed while loading AppClientFacade.class. So, the resource path was "/org/glassfish/appclient/client/AppClientFacade.class". This is fine in OSGi mode, because the bundle classloader is able to look up the resource whether the path has '/' prefix or not. But since the static GlassFish is loaded using URLClassloader, the lookup of the resource whose path is prefixed with '/' fails. (thats how the URL classloaders work). The following simple change fixes the issue, and it works fine in both OSGi and Non-OSGi modes: Index: server/core/src/main/java/org/glassfish/appclient/server/core/AppClientDeployerHelper.java =================================================================== — server/core/src/main/java/org/glassfish/appclient/server/core/AppClientDeployerHelper.java (revision 46414) +++ server/core/src/main/java/org/glassfish/appclient/server/core/AppClientDeployerHelper.java (working copy) @@ -521,7 +521,7 @@ private void copyClass(final WritableArchive facadeArchive, final String classResourcePath) throws IOException { OutputStream os = facadeArchive.putNextEntry(classResourcePath); InputStream is = openByteCodeStream("/" + classResourcePath); + InputStream is = openByteCodeStream(classResourcePath); copyStream(is, os); try { Index: server/core/src/main/java/org/glassfish/appclient/server/core/AppClientGroupFacadeGenerator.java =================================================================== — server/core/src/main/java/org/glassfish/appclient/server/core/AppClientGroupFacadeGenerator.java (revision 46414) +++ server/core/src/main/java/org/glassfish/appclient/server/core/AppClientGroupFacadeGenerator.java (working copy) @@ -261,7 +261,7 @@ OutputStream os = facadeArchive.putNextEntry(mainClassResourceName); try { - InputStream is = openByteCodeStream("/" + mainClassResourceName); + InputStream is = openByteCodeStream(mainClassResourceName); AppClientDeployerHelper.copyStream(is, os); is.close(); } catch (Exception e) {
          Hide
          Tim Quinn added a comment -

          Fix checked in for 3.2-b05. (the list of values for Fix Version does not have that build yet)

          Sending /Users/Tim/asgroup/v3/H/v3/appclient/server/core/src/main/java/org/glassfish/appclient/server/core/AppClientDeployerHelper.java
          Sending /Users/Tim/asgroup/v3/H/v3/appclient/server/core/src/main/java/org/glassfish/appclient/server/core/AppClientGroupFacadeGenerator.java
          Transmitting file data ...
          Committed revision 46556.
          Revision: 46556
          Author : tjquinn
          Date : Apr 29, 2011 6:21:49 PM
          Fix for 16493

          Show
          Tim Quinn added a comment - Fix checked in for 3.2-b05. (the list of values for Fix Version does not have that build yet) Sending /Users/Tim/asgroup/v3/H/v3/appclient/server/core/src/main/java/org/glassfish/appclient/server/core/AppClientDeployerHelper.java Sending /Users/Tim/asgroup/v3/H/v3/appclient/server/core/src/main/java/org/glassfish/appclient/server/core/AppClientGroupFacadeGenerator.java Transmitting file data ... Committed revision 46556. Revision: 46556 Author : tjquinn Date : Apr 29, 2011 6:21:49 PM Fix for 16493
          Hide
          Tim Quinn added a comment -

          Reopening this as a candidate for 3.1.1.

          Why fix this issue in 3.1.1?
          affects embedded; non-embedded is OK so they do not behave the same

          Which is the targeted build of 3.1.1 for this fix?
          b10

          Do regression tests exist for this issue?
          not yet

          Which tests should QA (re)run to verify the fix did not destabilize GlassFish?
          regular tests which use an app client

          Show
          Tim Quinn added a comment - Reopening this as a candidate for 3.1.1. Why fix this issue in 3.1.1? affects embedded; non-embedded is OK so they do not behave the same Which is the targeted build of 3.1.1 for this fix? b10 Do regression tests exist for this issue? not yet Which tests should QA (re)run to verify the fix did not destabilize GlassFish? regular tests which use an app client
          Hide
          scatari added a comment -

          Approved for 3.1.1.

          Show
          scatari added a comment - Approved for 3.1.1.
          Hide
          Tim Quinn added a comment -

          Fix for 3.1.1 checked in:

          Project: glassfish
          Repository: svn
          Revision: 47714
          Author: tjquinn
          Date: 2011-06-27 18:46:51 UTC
          Link:

          Log Message:
          ------------
          Fix for 16493 in 3.1.1

          Same fix as for trunk.

          Approved for 3.1.1: Sathyan
          Tests: QL, deployment devtests

          Revisions:
          ----------
          47714

          Modified Paths:
          ---------------
          branches/3.1.1/appclient/server/core/src/main/java/org/glassfish/appclient/server/core/AppClientGroupFacadeGenerator.java
          branches/3.1.1/appclient/server/core/src/main/java/org/glassfish/appclient/server/core/AppClientDeployerHelper.java

          Show
          Tim Quinn added a comment - Fix for 3.1.1 checked in: Project: glassfish Repository: svn Revision: 47714 Author: tjquinn Date: 2011-06-27 18:46:51 UTC Link: Log Message: ------------ Fix for 16493 in 3.1.1 Same fix as for trunk. Approved for 3.1.1: Sathyan Tests: QL, deployment devtests Revisions: ---------- 47714 Modified Paths: --------------- branches/3.1.1/appclient/server/core/src/main/java/org/glassfish/appclient/server/core/AppClientGroupFacadeGenerator.java branches/3.1.1/appclient/server/core/src/main/java/org/glassfish/appclient/server/core/AppClientDeployerHelper.java
          Hide
          Tim Quinn added a comment -

          Forgot to mention: the test app attached to this issue deployed successfully to 3.1.1 after this fix.

          Show
          Tim Quinn added a comment - Forgot to mention: the test app attached to this issue deployed successfully to 3.1.1 after this fix.

            People

            • Assignee:
              Tim Quinn
              Reporter:
              Bhavanishankar
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: