Re: Wanted: example for Spring Security with wicket-auth-roles

2018-04-18 Thread Martin Grigorov
Hi Tom,

I do not remember everything by heart but basically it is:
1. Provide impl of Spring Security's UserDetailsService and make it a @Bean
2. In your AuthenticatedWebSession#authenticate() impl use Spring
Security's Authentication to do the work. It was something like
SecurityContextHolder.getContext().getAuthentication().autheticate(new
UsernamePasswordAuthentication(username, password))

In Spring Security's config (HttpSecurity) you need to tell SS what is the
url to your login and logout pages, and that you want to enable
"rememberMe" functionality.
You can use both SS and/or Wicket to authenticate access to pages and
resources by their mount paths.

On Wed, Apr 18, 2018 at 5:58 PM, Tom Götz  wrote:

> Hi!
>
> Does anyone have a working example for an integration of Spring Security
> and wicket-auth-roles? We currently use Wicket 7.9.0 and Spring Boot 2.x …
>
> We’d like to authenticate users via a login form (SignInPanel) and also
> use a „remember me“ cookie based authentication.
>
> Anyone?
>
>
> Cheers,
>Tom
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: ResourceStreamRequestHandler and page refresh

2018-04-18 Thread Sven Meier
Hi,

you'll have to update your page first and then initiate the download.

For Ajax you can use:
 
https://github.com/apache/wicket/blob/master/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/AjaxDownloadBehavior.java

For Wicket<8 you'll find its predecessor  AjaxDownload on the web.

Have fun
Sven

Am 19. April 2018 02:20:25 MESZ schrieb Lon Varscsak :
>Hey all,
>
>I've got a Link that I use to generate and download a report.  I'm
>using a
>ResourceStreamRequestHandler and
>getRequestCycle().scheduleRequestHandlerAfterCurrent which works fine,
>except that I was expecting my current request to finish as if it were
>a
>regular link.  In this case, I'd want it to refresh the page I'm on,
>but it
>doesn't do that.
>
>Anyway to accomplish this?
>
>-Lon


ResourceStreamRequestHandler and page refresh

2018-04-18 Thread Lon Varscsak
Hey all,

I've got a Link that I use to generate and download a report.  I'm using a
ResourceStreamRequestHandler and
getRequestCycle().scheduleRequestHandlerAfterCurrent which works fine,
except that I was expecting my current request to finish as if it were a
regular link.  In this case, I'd want it to refresh the page I'm on, but it
doesn't do that.

Anyway to accomplish this?

-Lon


Re: Problem with DiskDataStore

2018-04-18 Thread Francois Meillet
you can count all open file handles via lsof | wc -l

François



> Le 18 avr. 2018 à 17:42, Francois Meillet  a 
> écrit :
> 
> Hi Claudia,
> 
> you need to update the limits in the linux kernel
> have a look at 
> https://serverfault.com/questions/20387/too-many-open-files-on-debian?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
>  
> 
> 
> François
> 
> 
> 
>> Le 18 avr. 2018 à 17:24, Claudia Hirt > > a écrit :
>> 
>> Hi all,
>> 
>> I get the following error when there are a lot of sessions on the system:
>> 
>> [4/18/18 11:49:59:291 CEST] 0080 SystemOut O myapp 18/04/2018 
>> 11:49:59,282 ERROR  (DiskDataStore.java:434) 
>> -/QIBM/UserData/WebSphere/AppServer/V85/Express/profiles/node01/temp/node01/node01/myapp/myapp.war/wicket.wicket-filestore/39/7429/6wE5N0QWVikdMSdO-oSbWCb/data
>>  (Too many open files)
>> java.io.FileNotFoundException: 
>> /QIBM/UserData/WebSphere/AppServer/V85/Express/profiles/node01/temp/node01/node01/myapp/myapp.war/wicket.wicket-filestore/39/7429/6wE5N0QWVikdMSdO-oSbWCb/data
>>  (Too many open files)
>>at java.io.RandomAccessFile.open(Native Method)
>>at java.io.RandomAccessFile.(RandomAccessFile.java:253)
>>at 
>> org.apache.wicket.pageStore.DiskDataStore$SessionEntry.getFileChannel(DiskDataStore.java:428)
>>at 
>> org.apache.wicket.pageStore.DiskDataStore$SessionEntry.savePage(DiskDataStore.java:346)
>>at 
>> org.apache.wicket.pageStore.DiskDataStore.storeData(DiskDataStore.java:185)
>>at 
>> org.apache.wicket.pageStore.AsynchronousDataStore$PageSavingRunnable.run(AsynchronousDataStore.java:355)
>>at java.lang.Thread.run(Thread.java:798)
>> 
>> This leads to a total breakdown of file system in my case.
>> I saw this already was an issue here: 
>> http://apache-wicket.1842946.n4.nabble.com/DiskDataStore-errors-in-production-td4665842.html
>>  
>> 
>>  but there was no solution.
>> 
>> Are there some settings in PageStore or anything to avoid this problem?
>> 
>> Best regards,
>> Claudia Hirt
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org 
>> 
>> For additional commands, e-mail: users-h...@wicket.apache.org 
>> 
>> 
> 



Re: Problem with DiskDataStore

2018-04-18 Thread Francois Meillet
Hi Claudia,

you need to update the limits in the linux kernel
have a look at 
https://serverfault.com/questions/20387/too-many-open-files-on-debian?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
 


François



> Le 18 avr. 2018 à 17:24, Claudia Hirt  a écrit :
> 
> Hi all,
> 
> I get the following error when there are a lot of sessions on the system:
> 
> [4/18/18 11:49:59:291 CEST] 0080 SystemOut O myapp 18/04/2018 
> 11:49:59,282 ERROR  (DiskDataStore.java:434) 
> -/QIBM/UserData/WebSphere/AppServer/V85/Express/profiles/node01/temp/node01/node01/myapp/myapp.war/wicket.wicket-filestore/39/7429/6wE5N0QWVikdMSdO-oSbWCb/data
>  (Too many open files)
> java.io.FileNotFoundException: 
> /QIBM/UserData/WebSphere/AppServer/V85/Express/profiles/node01/temp/node01/node01/myapp/myapp.war/wicket.wicket-filestore/39/7429/6wE5N0QWVikdMSdO-oSbWCb/data
>  (Too many open files)
>at java.io.RandomAccessFile.open(Native Method)
>at java.io.RandomAccessFile.(RandomAccessFile.java:253)
>at 
> org.apache.wicket.pageStore.DiskDataStore$SessionEntry.getFileChannel(DiskDataStore.java:428)
>at 
> org.apache.wicket.pageStore.DiskDataStore$SessionEntry.savePage(DiskDataStore.java:346)
>at 
> org.apache.wicket.pageStore.DiskDataStore.storeData(DiskDataStore.java:185)
>at 
> org.apache.wicket.pageStore.AsynchronousDataStore$PageSavingRunnable.run(AsynchronousDataStore.java:355)
>at java.lang.Thread.run(Thread.java:798)
> 
> This leads to a total breakdown of file system in my case.
> I saw this already was an issue here: 
> http://apache-wicket.1842946.n4.nabble.com/DiskDataStore-errors-in-production-td4665842.html
>  but there was no solution.
> 
> Are there some settings in PageStore or anything to avoid this problem?
> 
> Best regards,
> Claudia Hirt
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 



Problem with DiskDataStore

2018-04-18 Thread Claudia Hirt

Hi all,

I get the following error when there are a lot of sessions on the system:

[4/18/18 11:49:59:291 CEST] 0080 SystemOut O myapp 18/04/2018 
11:49:59,282 ERROR  (DiskDataStore.java:434) 
-/QIBM/UserData/WebSphere/AppServer/V85/Express/profiles/node01/temp/node01/node01/myapp/myapp.war/wicket.wicket-filestore/39/7429/6wE5N0QWVikdMSdO-oSbWCb/data 
(Too many open files)
java.io.FileNotFoundException: 
/QIBM/UserData/WebSphere/AppServer/V85/Express/profiles/node01/temp/node01/node01/myapp/myapp.war/wicket.wicket-filestore/39/7429/6wE5N0QWVikdMSdO-oSbWCb/data 
(Too many open files)

at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.(RandomAccessFile.java:253)
at 
org.apache.wicket.pageStore.DiskDataStore$SessionEntry.getFileChannel(DiskDataStore.java:428)
at 
org.apache.wicket.pageStore.DiskDataStore$SessionEntry.savePage(DiskDataStore.java:346)
at 
org.apache.wicket.pageStore.DiskDataStore.storeData(DiskDataStore.java:185)
at 
org.apache.wicket.pageStore.AsynchronousDataStore$PageSavingRunnable.run(AsynchronousDataStore.java:355)

at java.lang.Thread.run(Thread.java:798)

This leads to a total breakdown of file system in my case.
I saw this already was an issue here: 
http://apache-wicket.1842946.n4.nabble.com/DiskDataStore-errors-in-production-td4665842.html 
but there was no solution.


Are there some settings in PageStore or anything to avoid this problem?

Best regards,
Claudia Hirt


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



Wanted: example for Spring Security with wicket-auth-roles

2018-04-18 Thread Tom Götz
Hi!

Does anyone have a working example for an integration of Spring Security and 
wicket-auth-roles? We currently use Wicket 7.9.0 and Spring Boot 2.x …

We’d like to authenticate users via a login form (SignInPanel) and also use a 
„remember me“ cookie based authentication.

Anyone?


Cheers,
   Tom




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



Re: Wicket's LazyInitProxyFactory runs incorrectly at WebLogic...

2018-04-18 Thread tomask79
So Option two?


--
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



Re: Wicket's LazyInitProxyFactory runs incorrectly at WebLogic...

2018-04-18 Thread Martin Grigorov
On Wed, Apr 18, 2018 at 11:53 AM, tomask79  wrote:

> 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)Application.get()
>  .getApplicationSettings()
>  .getClassResolver()
>  .resolveClass(className);
>  }
>
> This is skipped...and Wicket goes here...
>
>  if (resolved == null)
>  {
>  resolved =
> (Class)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  Class resolveClass(final String className)
> {
> Class resolved = null;
> try
> {
> if (Application.exists())
> {
> resolved = (Class)Application.get()
> .getApplicationSettings()
> .getClassResolver()
> .resolveClass(className);
> }
>
> if (resolved == null)
> {
> resolved = (Class)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?
>

The Thread context classloader and the one that loaded the class is not
always the same.
I'd rather add yet another "if (class == null)
{tryWithWicketObjectsClassClassLoader}" after trying with the thread
context loader.

WebLogic (like WebSphere) are rather exotic application servers and they
are known for not following the standards.
I don't want to break any other application that works fine on *normal*
servers.

Please test my suggestion and send a PR, or at least open a ticket in JIRA.


>
>
> --
> 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
>
>


Re: Wicket's LazyInitProxyFactory runs incorrectly at WebLogic...

2018-04-18 Thread tomask79
"I guess the difference is in handling situation when  Application.exists() 
== false "

Exactly, as Maxim said.

--
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



Re: Wicket's LazyInitProxyFactory runs incorrectly at WebLogic...

2018-04-18 Thread tomask79
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)Application.get() 
 .getApplicationSettings() 
 .getClassResolver() 
 .resolveClass(className); 
 } 

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

 if (resolved == null) 
 { 
 resolved =
(Class)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  Class resolveClass(final String className)
{
Class resolved = null;
try
{
if (Application.exists())
{
resolved = (Class)Application.get()
.getApplicationSettings()
.getClassResolver()
.resolveClass(className);
}

if (resolved == null)
{
resolved = (Class)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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket's LazyInitProxyFactory runs incorrectly at WebLogic...

2018-04-18 Thread Maxim Solodovnik
I guess the difference is in handling situation when  Application.exists()
== false

On Wed, Apr 18, 2018 at 3:24 PM, Martin Grigorov 
wrote:

> Hi,
>
> On Wed, Apr 18, 2018 at 11:10 AM, tomask79 
> 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  Class resolveClass(final String className)
> > {
> > Class resolved = null;
> > try
> > {
> > if (Application.exists())
> > {
> > resolved = (Class)Application.get()
> > .getApplicationSettings()
> > .getClassResolver()
> > .resolveClass(className);
> > }
> >
> > if (resolved == null)
> > {
> > resolved = (Class)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


Re: Wicket's LazyInitProxyFactory runs incorrectly at WebLogic...

2018-04-18 Thread Martin Grigorov
Hi,

On Wed, Apr 18, 2018 at 11:10 AM, tomask79  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  Class resolveClass(final String className)
> {
> Class resolved = null;
> try
> {
> if (Application.exists())
> {
> resolved = (Class)Application.get()
> .getApplicationSettings()
> .getClassResolver()
> .resolveClass(className);
> }
>
> if (resolved == null)
> {
> resolved = (Class)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
>
>


Wicket's LazyInitProxyFactory runs incorrectly at WebLogic...

2018-04-18 Thread tomask79
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  Class resolveClass(final String className)
{
Class resolved = null;
try
{
if (Application.exists())
{
resolved = (Class)Application.get()
.getApplicationSettings()
.getClassResolver()
.resolveClass(className);
}

if (resolved == null)
{
resolved = (Class)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