Hi,

WLS has a feature that allows a user to ship jars in their EAR and
configure their EAR to use their copies of the jars instead of the
ones that WLS ships with. We do this with some funky classloaders that
don't delegate in the "normal" way. We were running into an issue
where if a user put OpenJPA into their EAR and deployed it into WLS,
they could not use the EAR-specified version, because when we were
loading service implementations via the modified methods, there was a
classloader mismatch.

I copied the fix to 1.0.x so that once 1.0.2 is released, people will
be able to put either 1.0.2 or 1.1.0 into their EARs.

-Patrick

On Jan 8, 2008 9:38 AM, Kevin Sutter <[EMAIL PROTECTED]> wrote:
> Patrick,
> Can you expand on how this problem surfaced?  I looked back at r603666 and
> the commit basically has the same text.  Was there a JIRA issue or dev
> mailing post that prompted this change?  Or, did you just come across it
> while performing other development/test activities.  The reason it's
> catching my eye is because you ported it back to 1.0.x, so you must think
> it's important.  Thanks for any background you can provide.
>
> (We are looking at a problem reported through the WebSphere EJB3 Feature
> Pack and this sounds like it could be related.  I'm just trying to determine
> the context for the fix.  Thanks.)
>
> Kevin
>
>
> On Jan 7, 2008 2:09 PM, <[EMAIL PROTECTED]> wrote:
>
> > Author: pcl
> > Date: Mon Jan  7 12:09:05 2008
> > New Revision: 609766
> >
> > URL: http://svn.apache.org/viewvc?rev=609766&view=rev
> > Log:
> > Port of r603666 to 1.0.x. Change Services.getImplementorClasses(Class) and
> > Services.getImplementorClasses(Class,ClassLoader) to filter out
> > implementations that are not assignable to the Class argument. This allows
> > the Services call to be more fault-tolerant in environments with odd
> > classloader configurations.
> >
> > Modified:
> >
> >  
> > openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Services.java
> >
> > Modified:
> > openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Services.java
> > URL:
> > http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Services.java?rev=609766&r1=609765&r2=609766&view=diff
> >
> > ==============================================================================
> > ---
> > openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Services.java
> > (original)
> > +++
> > openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/util/Services.java
> > Mon Jan  7 12:09:05 2008
> > @@ -25,7 +25,9 @@
> >  import java.net.URL;
> >  import java.security.AccessController;
> >  import java.util.ArrayList;
> > +import java.util.Arrays;
> >  import java.util.Enumeration;
> > +import java.util.HashSet;
> >  import java.util.List;
> >  import java.util.Set;
> >  import java.util.StringTokenizer;
> > @@ -145,7 +147,21 @@
> >
> >     public static Class[] getImplementorClasses(Class serviceClass,
> >         ClassLoader loader) {
> > -        return getImplementorClasses(serviceClass.getName(), loader);
> > +        Set invalid = new HashSet();
> > +        Class[] classes = getImplementorClasses(serviceClass.getName(),
> > loader);
> > +
> > +        // filter out any classes that have any classloader issues wrt.
> > +        // the specified service class.
> > +        for (int i = 0; i < classes.length; i++)
> > +            if (!serviceClass.isAssignableFrom(classes[i]))
> > +                invalid.add(classes[i]);
> > +        if (invalid.size() != 0) {
> > +            List list = new ArrayList(Arrays.asList(classes));
> > +            list.removeAll(invalid);
> > +            return (Class[]) list.toArray(new Class[list.size()]);
> > +        } else {
> > +            return classes;
> > +        }
> >     }
> >
> >     /**
> >
> >
> >
>



-- 
Patrick Linskey
202 669 5907

Reply via email to