Hi Martin,

"Here it is not very clear what exactly is the change. One has to diff it 
agaisnt the original code to see what you have added/removed. "

I added following:

clazz = Class.forName(type, false, this.getClass().getClassLoader()); 
if (clazz == null) { 
throw Exception...

I need to force the framework to use the application classloader...different
to currentThread's classloader...

"You can use custom IClassResolver, no ? 
One that does whatever WebLogic needs to resolve the class and don't break 
or return null. "

Unfortunatelly Wicket's classResolver won't help you, because we've got a
problem during HTTP session serialization which isn't Wicket's application
thread....

if (Application.exists()) 
                         { 
                                 resolved = (Class<T>)Application.get() 
                                         .getApplicationSettings() 
                                         .getClassResolver() 
                                         .resolveClass(className); 
                         } 

This is skipped...and Wicket goes here...

 if (resolved == null) 
                         { 
                                 resolved =
(Class<T>)Class.forName(className, false, 
 Thread.currentThread() .getContextClassLoader()); 
                         } 


which ends with ClassNotFoundException when having @SpringBean in WebSession
and If WLS doesn't have ChangeAware classloader bindided to thread.

Suggested changes:

1) Either to change:

static class ProxyReplacement implements IClusterable { 
         private static final long serialVersionUID = 1L; 
         private final IProxyTargetLocator locator; 
         private final String type; 
 
         public ProxyReplacement(String type, IProxyTargetLocator locator) { 
             this.type = type; 
             this.locator = locator; 
         } 
 
         private Object readResolve() throws ObjectStreamException { 
             Class<?> clazz = WicketObjects.resolveClass(this.type); 
             if (clazz == null) { 
                 clazz = Class.forName(type, false, 
 this.getClass().getClassLoader()); 
                 if (clazz == null) { 
                      ClassNotFoundException cause = new 
 ClassNotFoundException("Could not resolve type [" 
                      + this.type + "] with the currently configured 
                       org.apache.wicket.application.IClassResolver"); 
                        throw new WicketRuntimeException(cause); 
                } 
             } else { 
                 return LazyInitProxyFactory.createProxy(clazz, 
 this.locator); 
             } 
         } 
     } 

2) Another possible fix (WicketObjects):

public static <T> Class<T> resolveClass(final String className)
        {
                Class<T> resolved = null;
                try
                {
                        if (Application.exists())
                        {
                                resolved = (Class<T>)Application.get()
                                        .getApplicationSettings()
                                        .getClassResolver()
                                        .resolveClass(className);
                        }

                        if (resolved == null)
                        {
                                resolved = (Class<T>)Class.forName(className, 
false,
WicketObjects.class.getClassLoader());
                        }
                }
                catch (ClassNotFoundException cnfx)
                {
                        log.warn("Could not resolve class [" + className + "]", 
cnfx);
                }
                return resolved;
        }

Both changes have the same effect...Please would you be willing to propagate
this into the patch?


--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to