Hi All,

First off, it has been a loooooong time since I have had to submit a
patch (with the Jetspeed project I had the luxury of just committing).
Hopefully the format is correct (it was generated from Subclipse so I am
guessing it should be).

Okay, that out of the way on to the important part.  This patch
addresses an issue with classloading performed by
wicket.proxy.LazyInitProxyFactory within the context of a Weblogic
Server 9.2 clustered application environment (stack trace at the bottom
of the email).  The long and the short of it is that
Thread.currentThread().getContextClassLoader() will fail to load the
proxied interface.  The fix was quite simple: catch the IAE and attempt
to load the interface using the current classloader
(LazyInitProxyFactory.class.getClassLoader()).  This works like a charm
and I have had in production for almost 3 months now with no issues
whatsoever.

Regards,
-scott

<Nov 20, 2006 10:23:18 AM EST> <Error> <Kernel> <BEA-000802>
<ExecuteRequest fai

led

 java.lang.IllegalArgumentException: interface
com.ugs.it.partnersxpress.util.Or

derTrackingBeanFactory is not visible from class loader.

java.lang.IllegalArgumentException: interface
com.ugs.it.partnersxpress.util.Ord

erTrackingBeanFactory is not visible from class loader

        at
weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:195)

        at
weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:224)

        at
weblogic.cluster.replication.ReplicationManager_920_WLStub.update(Unk

nown Source)

        at
weblogic.cluster.replication.ReplicationManager.updateSecondary(Repli

cationManager.java:525)

        at
weblogic.servlet.internal.session.ReplicatedSessionData.syncSession(R

eplicatedSessionData.java:516)

        Truncated. see log file for complete stacktrace

java.lang.IllegalArgumentException: interface
com.ugs.it.partnersxpress.util.Ord

erTrackingBeanFactory is not visible from class loader

        at java.lang.reflect.Proxy.getProxyClass(Proxy.java:345)

        at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:564)

        at
wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.ja

va:124)

        at
wicket.proxy.LazyInitProxyFactory$ProxyReplacement.readResolve(LazyIn

itProxyFactory.java:206)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        Truncated. see log file for complete stacktrace

> 

<Nov 20, 2006 10:23:18 AM EST> <Error> <Kernel> <BEA-000802>
<ExecuteRequest fai

led

 java.lang.IllegalArgumentException: interface
com.ugs.it.partnersxpress.util.Or

derTrackingBeanFactory is not visible from class loader.

java.lang.IllegalArgumentException: interface
com.ugs.it.partnersxpress.util.Ord

erTrackingBeanFactory is not visible from class loader

        at
weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:195)

        at
weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:224)

        at
weblogic.cluster.replication.ReplicationManager_920_WLStub.update(Unk

nown Source)

        at
weblogic.cluster.replication.ReplicationManager.updateSecondary(Repli

cationManager.java:525)

        at
weblogic.servlet.internal.session.ReplicatedSessionData.syncSession(R

eplicatedSessionData.java:516)

        Truncated. see log file for complete stacktrace

java.lang.IllegalArgumentException: interface
com.ugs.it.partnersxpress.util.Ord

erTrackingBeanFactory is not visible from class loader

        at java.lang.reflect.Proxy.getProxyClass(Proxy.java:345)

        at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:564)

        at
wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.ja

va:124)

        at
wicket.proxy.LazyInitProxyFactory$ProxyReplacement.readResolve(LazyIn

itProxyFactory.java:206)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        Truncated. see log file for complete stacktrace

>
Index: 
D:/workspace/wicket-spring-SVN/src/main/java/wicket/proxy/LazyInitProxyFactory.java
===================================================================
--- 
D:/workspace/wicket-spring-SVN/src/main/java/wicket/proxy/LazyInitProxyFactory.java
 (revision 506487)
+++ 
D:/workspace/wicket-spring-SVN/src/main/java/wicket/proxy/LazyInitProxyFactory.java
 (working copy)
@@ -121,9 +121,24 @@
                {
                        JdkHandler handler = new JdkHandler(type, locator);
 
-                       return 
Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
-                                       new Class[] {type, Serializable.class, 
ILazyInitProxy.class,
-                                                       IWriteReplace.class}, 
handler);
+                       try
+                       {
+                               return 
Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
+                                               new Class[] {type, 
Serializable.class, ILazyInitProxy.class,
+                                                               
IWriteReplace.class}, handler);
+                       }
+                       catch (IllegalArgumentException e)
+                       {
+                               /*             
+                    * STW: In some clustering environments it appears the 
context classloader fails
+                    * to load the proxied interface (currently seen in BEA WLS 
9.x clusters).  
+                    * If this happens, we can try and fall back to the 
classloader (current) that actually 
+                    * loaded this class.
+                                */
+                               return 
Proxy.newProxyInstance(LazyInitProxyFactory.class.getClassLoader(),
+                        new Class[] {type, Serializable.class, 
ILazyInitProxy.class,
+                                IWriteReplace.class}, handler);
+                       }
 
                }
                else

Reply via email to