I guess the difference is in handling situation when Application.exists() == false
On Wed, Apr 18, 2018 at 3:24 PM, Martin Grigorov <mgrigo...@apache.org> wrote: > Hi, > > On Wed, Apr 18, 2018 at 11:10 AM, tomask79 <tomas.klou...@embedit.cz> > wrote: > > > 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); > > } > > } > > } > > > > 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. > > > > > > 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; > > } > > s > > 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.... > > > > You can use custom IClassResolver, no ? > One that does whatever WebLogic needs to resolve the class and don't break > or return null. > > > > 2) Or can you please put my suggested change of > > ProxyReplacement.readResolve > > into some patched version of 6.21? > > > > patched version of 6.21 sounds like a local build that you can do. > We can release 6.30 and you will have to upgrade. > > > > > > > > > > > > > > > > > > -- > > 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 > > > > > -- WBR Maxim aka solomax