Hi guys,

this is the continuation of 

http://apache-wicket.1842946.n4.nabble.com/SpringBean-inside-WebSession-td4680162.html

We have found the root cause:

Is somehow possible to replace LazyInitProxyFactory.ProxyReplacement with
custom implementation?

Why I need that? I need following code tweak:

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);
            }
        }
    }

Reason: 

WicketObject.resolveClass is incorrect:

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,
Thread.currentThread()
                                        .getContextClassLoader());
                        }
                }
                catch (ClassNotFoundException cnfx)
                {
                        log.warn("Could not resolve class [" + className + "]", 
cnfx);
                }
                return resolved;
        }

Thread.currentThread().getContextClassLoader() when replicating session at
WebLogic this sometimes returns non-application classloader which ends with
mentioned ClassNotFoundException.....Also "if (resolved == null)" part is
useless if first part throws Exception....

We use Wicket 6.21.

1) Either is possible to replace LazyInitProxyFactory with custom
implementation....
2) Or can you please put my suggested change of ProxyReplacement.readResolve
into some patched version of 6.21?







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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to