[jira] Created: (CARGO-491) Add support for Glassfish

View: New views
3 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

[jira] Commented: (CARGO-491) Add support for Glassfish

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/CARGO-491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=197270#action_197270 ]

Christopher Rued commented on CARGO-491:
----------------------------------------

I have been having quite a bit of trouble trying to get this to run on Ant...eventually, it seems, it came down to a classloader problem.  Somehow the GlassFish classes weren't found in the "Context" classpath but were in the classloader associated with the AbstractFactoryRegistry class.

Here's a patch that seems to make things work: the basic idea is to use ALL classloaders, rather than just the first one we find:

Index: AbstractFactoryRegistry.java
===================================================================
--- AbstractFactoryRegistry.java        (revision 1987)
+++ AbstractFactoryRegistry.java        (working copy)
@@ -251,27 +251,24 @@
     private static List list(ClassLoader classLoader)
     {
         ClassLoader cl = classLoader;
-        if (cl == null)
-        {
-            cl = Thread.currentThread().getContextClassLoader();
+        ClassLoaders loaders = new ClassLoaders();
+        cl = AbstractFactoryRegistry.class.getClassLoader();
+        if (cl != null) {
+            loaders.put(cl);
         }
-        if (cl == null)
-        {
-            cl = AbstractFactoryRegistry.class.getClassLoader();
+        cl = Thread.currentThread().getContextClassLoader();
+        if (cl != null) {
+            loaders.put(cl);
         }
-        if (cl == null)
-        {
-            cl = JDKHooks.getJDKHooks().getSystemClassLoader();
+        cl = JDKHooks.getJDKHooks().getSystemClassLoader();
+        if (cl != null) {
+            loaders.put(cl);
         }
-        if (cl == null)
-        {
+        if (loaders.size() == 0) {
             // this is not our day. bail out.
             return Collections.EMPTY_LIST;
         }

-        ClassLoaders loaders = new ClassLoaders();
-        loaders.put(cl);
-
         List registries = new ArrayList();
         Enumeration providers = Service.providers(
                 new SPInterface(AbstractFactoryRegistry.class), loaders);





This makes the list method look like this:

    private static List list(ClassLoader classLoader)
    {
        ClassLoader cl = classLoader;
        ClassLoaders loaders = new ClassLoaders();
        cl = AbstractFactoryRegistry.class.getClassLoader();
        if (cl != null) {
            loaders.put(cl);
        }
        cl = Thread.currentThread().getContextClassLoader();
        if (cl != null) {
            loaders.put(cl);
        }
        cl = JDKHooks.getJDKHooks().getSystemClassLoader();
        if (cl != null) {
            loaders.put(cl);
        }
        if (loaders.size() == 0) {
            // this is not our day. bail out.
            return Collections.EMPTY_LIST;
        }

        List registries = new ArrayList();
        Enumeration providers = Service.providers(
                new SPInterface(AbstractFactoryRegistry.class), loaders);
        while (providers.hasMoreElements())
        {
            Object provider = providers.nextElement();
            if (provider instanceof AbstractFactoryRegistry)
            {
                registries.add(provider);
            }
        }

        return registries;
    }

> Add support for Glassfish
> -------------------------
>
>                 Key: CARGO-491
>                 URL: http://jira.codehaus.org/browse/CARGO-491
>             Project: Cargo
>          Issue Type: New Feature
>          Components: Glassfish
>    Affects Versions: 0.8
>         Environment: Sun OS 10/SPARC, Sun Java System Application Server Platform Edition 9.0_01
>            Reporter: Marwan Zeineddine
>            Priority: Trivial
>         Attachments: CARGO-491_draft_v1.diff
>
>
> Attempting to finish work initiated by Kohsuke Kawagushi. I am following the standard procedure for adding a container. I have searched the bug database for anything relating to glassfish or sun app server and didn't find any, i may have missed some.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Updated: (CARGO-491) Add support for Glassfish

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/CARGO-491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christopher Rued updated CARGO-491:
-----------------------------------

    Attachment: patch.txt

Patch to have AbstractFactoryRegistry search for providers in ALL classloaders rather than just the first classloader it can find.

> Add support for Glassfish
> -------------------------
>
>                 Key: CARGO-491
>                 URL: http://jira.codehaus.org/browse/CARGO-491
>             Project: Cargo
>          Issue Type: New Feature
>          Components: Glassfish
>    Affects Versions: 0.8
>         Environment: Sun OS 10/SPARC, Sun Java System Application Server Platform Edition 9.0_01
>            Reporter: Marwan Zeineddine
>            Priority: Trivial
>         Attachments: CARGO-491_draft_v1.diff, patch.txt
>
>
> Attempting to finish work initiated by Kohsuke Kawagushi. I am following the standard procedure for adding a container. I have searched the bug database for anything relating to glassfish or sun app server and didn't find any, i may have missed some.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Issue Comment Edited: (CARGO-491) Add support for Glassfish

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/CARGO-491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=197270#action_197270 ]

Christopher Rued edited comment on CARGO-491 at 11/5/09 8:36 AM:
-----------------------------------------------------------------

I have been having quite a bit of trouble trying to get this to run on Ant...eventually, it seems, it came down to a classloader problem.  Somehow the GlassFish classes weren't found in the "Context" classpath but were in the classloader associated with the AbstractFactoryRegistry class.

Here's a patch that seems to make things work: the basic idea is to use ALL classloaders, rather than just the first one we find:

(patch attached to this issue)

      was (Author: crued):
    I have been having quite a bit of trouble trying to get this to run on Ant...eventually, it seems, it came down to a classloader problem.  Somehow the GlassFish classes weren't found in the "Context" classpath but were in the classloader associated with the AbstractFactoryRegistry class.

Here's a patch that seems to make things work: the basic idea is to use ALL classloaders, rather than just the first one we find:

Index: AbstractFactoryRegistry.java
===================================================================
--- AbstractFactoryRegistry.java        (revision 1987)
+++ AbstractFactoryRegistry.java        (working copy)
@@ -251,27 +251,24 @@
     private static List list(ClassLoader classLoader)
     {
         ClassLoader cl = classLoader;
-        if (cl == null)
-        {
-            cl = Thread.currentThread().getContextClassLoader();
+        ClassLoaders loaders = new ClassLoaders();
+        cl = AbstractFactoryRegistry.class.getClassLoader();
+        if (cl != null) {
+            loaders.put(cl);
         }
-        if (cl == null)
-        {
-            cl = AbstractFactoryRegistry.class.getClassLoader();
+        cl = Thread.currentThread().getContextClassLoader();
+        if (cl != null) {
+            loaders.put(cl);
         }
-        if (cl == null)
-        {
-            cl = JDKHooks.getJDKHooks().getSystemClassLoader();
+        cl = JDKHooks.getJDKHooks().getSystemClassLoader();
+        if (cl != null) {
+            loaders.put(cl);
         }
-        if (cl == null)
-        {
+        if (loaders.size() == 0) {
             // this is not our day. bail out.
             return Collections.EMPTY_LIST;
         }

-        ClassLoaders loaders = new ClassLoaders();
-        loaders.put(cl);
-
         List registries = new ArrayList();
         Enumeration providers = Service.providers(
                 new SPInterface(AbstractFactoryRegistry.class), loaders);





This makes the list method look like this:

    private static List list(ClassLoader classLoader)
    {
        ClassLoader cl = classLoader;
        ClassLoaders loaders = new ClassLoaders();
        cl = AbstractFactoryRegistry.class.getClassLoader();
        if (cl != null) {
            loaders.put(cl);
        }
        cl = Thread.currentThread().getContextClassLoader();
        if (cl != null) {
            loaders.put(cl);
        }
        cl = JDKHooks.getJDKHooks().getSystemClassLoader();
        if (cl != null) {
            loaders.put(cl);
        }
        if (loaders.size() == 0) {
            // this is not our day. bail out.
            return Collections.EMPTY_LIST;
        }

        List registries = new ArrayList();
        Enumeration providers = Service.providers(
                new SPInterface(AbstractFactoryRegistry.class), loaders);
        while (providers.hasMoreElements())
        {
            Object provider = providers.nextElement();
            if (provider instanceof AbstractFactoryRegistry)
            {
                registries.add(provider);
            }
        }

        return registries;
    }
 

> Add support for Glassfish
> -------------------------
>
>                 Key: CARGO-491
>                 URL: http://jira.codehaus.org/browse/CARGO-491
>             Project: Cargo
>          Issue Type: New Feature
>          Components: Glassfish
>    Affects Versions: 0.8
>         Environment: Sun OS 10/SPARC, Sun Java System Application Server Platform Edition 9.0_01
>            Reporter: Marwan Zeineddine
>            Priority: Trivial
>         Attachments: CARGO-491_draft_v1.diff, patch.txt
>
>
> Attempting to finish work initiated by Kohsuke Kawagushi. I am following the standard procedure for adding a container. I have searched the bug database for anything relating to glassfish or sun app server and didn't find any, i may have missed some.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


< Prev | 1 - 2 | Next >