You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Steven Haines <ly...@yahoo.com> on 2010/07/01 04:45:13 UTC
Wicket Sessions and Load Balancing
Hi,
I just setup my production environment for a wicket-based application today and
I am having a problem with "Page Expired" messages. I have three servers that
are not clustered together, but rather are configured with Apache's
proxy_balancer to use sticky sessions (with failover turned off.) The homepage
always loads, but a high percentage of the time when I enter the second page of
my application I receive a "Page Expired" page - clicking on that takes me back
to the home page and then the application works.
My guess is that when the homepage is loaded that Wicket provides a new
jsessionid (I sometimes see it coming in the submission url) but then the user
is directed to another server on the next request, and because the user does not
yet have a JSESSIONID cookie, but does have the jsessionid in the URL, the
Wicket instance that receives the request searches and cannot find the session
id and marks the page as expired. The next request then populates the browser's
cookie and the sticky session works.This is just a theory, but it would explain
the behavior.
I thought I handled this case in the proxy_balancer configuration with an entry
like the following:
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid
nofailover=On
Where JSESSIONID|jsessionid covers the cookie and encoded path, respectively,
and the nofailover=On tells Apache to not to try to fail a user's session over
to antoher server.
Has anyone faced this problem? Any ideas on how to resolve it? And we're going
to start allow production load very shortly, so any insight would be much
appreciated!
Thanks
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket Sessions and Load Balancing
Posted by Setya <js...@gmail.com>.
Hi,
I'm experiencing the same problem, only I use mod_jk. How did you solve the
problem ?
Thanks & Regards,
Setya
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Sessions-and-Load-Balancing-tp2274552p3259914.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket Sessions and Load Balancing
Posted by Erik van Oosten <e....@grons.nl>.
Steven,
Have you tried to enforce creation of a session on the home page?
A WebSession.get().bind() in the homepage will do the trick.
This only makes a difference when your homepage is stateless.
Regards,
Erik.
> 2010/7/1 Steven Haines<lygado@yahoo.com
>> My guess is that when the homepage is loaded that Wicket provides a new
>> jsessionid (I sometimes see it coming in the submission url) but then the
>> user
>> is directed to another server on the next request, and because the user
>> does not
>> yet have a JSESSIONID cookie, but does have the jsessionid in the URL, the
>> Wicket instance that receives the request searches and cannot find the
>> session
>> id and marks the page as expired. The next request then populates the
>> browser's
>> cookie and the sticky session works.This is just a theory, but it would
>> explain
>> the behavior.
>>
>>
--
Sent from my SMTP compliant software
Erik van Oosten
http://day-to-day-stuff.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Wicket Sessions and Load Balancing
Posted by nino martinez wael <ni...@gmail.com>.
Hi Steven
Unfortunately I havent been using the proxy for balancing for a while now..
But I know it works flawlessly with mod_jk, and if your using jetty you can
also get that running.
http://docs.codehaus.org/display/JETTY/Configuring+AJP13+Using+mod_jk .
Otherwise i'd go to the httpd forum and ask them, you usually get help there
:)
regards Nino
2010/7/1 Steven Haines <ly...@yahoo.com>
> Hi,
>
> I just setup my production environment for a wicket-based application today
> and
> I am having a problem with "Page Expired" messages. I have three servers
> that
> are not clustered together, but rather are configured with Apache's
> proxy_balancer to use sticky sessions (with failover turned off.) The
> homepage
> always loads, but a high percentage of the time when I enter the second
> page of
> my application I receive a "Page Expired" page - clicking on that takes me
> back
> to the home page and then the application works.
>
> My guess is that when the homepage is loaded that Wicket provides a new
> jsessionid (I sometimes see it coming in the submission url) but then the
> user
> is directed to another server on the next request, and because the user
> does not
> yet have a JSESSIONID cookie, but does have the jsessionid in the URL, the
> Wicket instance that receives the request searches and cannot find the
> session
> id and marks the page as expired. The next request then populates the
> browser's
> cookie and the sticky session works.This is just a theory, but it would
> explain
> the behavior.
>
> I thought I handled this case in the proxy_balancer configuration with an
> entry
> like the following:
>
> ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid
> nofailover=On
>
> Where JSESSIONID|jsessionid covers the cookie and encoded path,
> respectively,
> and the nofailover=On tells Apache to not to try to fail a user's session
> over
> to antoher server.
>
> Has anyone faced this problem? Any ideas on how to resolve it? And we're
> going
> to start allow production load very shortly, so any insight would be much
> appreciated!
>
> Thanks
>
> Steve
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Loading static javascript
Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Then you might want to use a resourcestream ?
Something like:
IResourceStream resourceStream = new AttachmentResourceStream(
new ByteArrayInputStream(item.getModelObject().getFile()));
getRequestCycle().setRequestTarget(
new ResourceStreamRequestTarget(resourceStream) {
@Override
public String getFileName() {
return item.getModelObject().getName();
}
});
static class AttachmentResourceStream extends AbstractResourceStream {
private InputStream attachment;
/**
* @param attachment
*/
AttachmentResourceStream(InputStream attachment) {
this.attachment = attachment;
}
/**
* @see org.apache.wicket.util.resource.IResourceStream#close()
*/
@Override
public void close() throws IOException {
attachment.close();
}
/**
* @see org.apache.wicket.util.resource.IResourceStream#getInputStream()
*/
@Override
public InputStream getInputStream() throws ResourceStreamNotFoundException {
return attachment;
}
}
**
Martin
2010/7/15 Jarosz Yohan <yo...@epfl.ch>:
> Perhaps I have badly explained something.
> my javascript files are not located in my webapps directory, but on the filesystem
> On Jul 15, 2010, at 6:31 PM, Jarosz Yohan wrote:
>
> In fact, this is not working too.
> I think it because wicket couldn't find my javascript file.
> when I give url (this file can be accessed via url also) it's working, but not with a filesystem path
> and I really need not to pass by filesytem...
>
> On Jul 15, 2010, at 6:06 PM, Martin Makundi wrote:
>
> This is easier:
>
> response.renderJavascriptReference("/js/jquery.js");
>
>
> **
> Martin
>
> 2010/7/15 Jarosz Yohan <yo...@epfl.ch>>:
> Hello,
>
> I'm trying to load statatic js files. I 'm using in the init of the application
>
> getResourceSettings().addResourceFolder("/somePath/");
> resourceSettings.setResourceStreamLocator(new RessourceLocator());
>
> with
> public class RessourceLocator extends ResourceStreamLocator{
> public RessourceLocator() {}
> public IResourceStream locate(final Class<?> clazz, final String path) {
> IResourceStream located = super.locate(clazz, trimFolders(path));
> if (located != null) {return located;}
> return super.locate(clazz, path);
> }
> private String trimFolders(String path) {
> return path.substring(path.lastIndexOf("/") + 1);}
> }
>
> and in my Page I have
> add(JavascriptPackageResource.getHeaderContribution("/myFile.js"));
> and of course myFile.js located under /somePath"
>
> what am I missing?
>
> Yohan
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org<ma...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org<ma...@wicket.apache.org>
>
>
> Jarosz Yohan
> Bioinformatics & Biostatistics Core Facility
> EPFL School of Life Sciences
>
> EPFL SV PTECH PTBB
> AAB 0 23
> Station 15
> 1015 Lausanne
> Switzerland
>
> phone: [+41 21 69] 31439
> email: yohan.jarosz@epfl.ch<ma...@epfl.ch>
>
>
>
>
> Jarosz Yohan
> Bioinformatics & Biostatistics Core Facility
> EPFL School of Life Sciences
>
> EPFL SV PTECH PTBB
> AAB 0 23
> Station 15
> 1015 Lausanne
> Switzerland
>
> phone: [+41 21 69] 31439
> email: yohan.jarosz@epfl.ch<ma...@epfl.ch>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Loading static javascript
Posted by Jarosz Yohan <yo...@epfl.ch>.
Perhaps I have badly explained something.
my javascript files are not located in my webapps directory, but on the filesystem
On Jul 15, 2010, at 6:31 PM, Jarosz Yohan wrote:
In fact, this is not working too.
I think it because wicket couldn't find my javascript file.
when I give url (this file can be accessed via url also) it's working, but not with a filesystem path
and I really need not to pass by filesytem...
On Jul 15, 2010, at 6:06 PM, Martin Makundi wrote:
This is easier:
response.renderJavascriptReference("/js/jquery.js");
**
Martin
2010/7/15 Jarosz Yohan <yo...@epfl.ch>>:
Hello,
I'm trying to load statatic js files. I 'm using in the init of the application
getResourceSettings().addResourceFolder("/somePath/");
resourceSettings.setResourceStreamLocator(new RessourceLocator());
with
public class RessourceLocator extends ResourceStreamLocator{
public RessourceLocator() {}
public IResourceStream locate(final Class<?> clazz, final String path) {
IResourceStream located = super.locate(clazz, trimFolders(path));
if (located != null) {return located;}
return super.locate(clazz, path);
}
private String trimFolders(String path) {
return path.substring(path.lastIndexOf("/") + 1);}
}
and in my Page I have
add(JavascriptPackageResource.getHeaderContribution("/myFile.js"));
and of course myFile.js located under /somePath"
what am I missing?
Yohan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org<ma...@wicket.apache.org>
For additional commands, e-mail: users-help@wicket.apache.org<ma...@wicket.apache.org>
Jarosz Yohan
Bioinformatics & Biostatistics Core Facility
EPFL School of Life Sciences
EPFL SV PTECH PTBB
AAB 0 23
Station 15
1015 Lausanne
Switzerland
phone: [+41 21 69] 31439
email: yohan.jarosz@epfl.ch<ma...@epfl.ch>
Jarosz Yohan
Bioinformatics & Biostatistics Core Facility
EPFL School of Life Sciences
EPFL SV PTECH PTBB
AAB 0 23
Station 15
1015 Lausanne
Switzerland
phone: [+41 21 69] 31439
email: yohan.jarosz@epfl.ch<ma...@epfl.ch>
Re: Loading static javascript
Posted by Jarosz Yohan <yo...@epfl.ch>.
In fact, this is not working too.
I think it because wicket couldn't find my javascript file.
when I give url (this file can be accessed via url also) it's working, but not with a filesystem path
and I really need not to pass by filesytem...
On Jul 15, 2010, at 6:06 PM, Martin Makundi wrote:
This is easier:
response.renderJavascriptReference("/js/jquery.js");
**
Martin
2010/7/15 Jarosz Yohan <yo...@epfl.ch>>:
Hello,
I'm trying to load statatic js files. I 'm using in the init of the application
getResourceSettings().addResourceFolder("/somePath/");
resourceSettings.setResourceStreamLocator(new RessourceLocator());
with
public class RessourceLocator extends ResourceStreamLocator{
public RessourceLocator() {}
public IResourceStream locate(final Class<?> clazz, final String path) {
IResourceStream located = super.locate(clazz, trimFolders(path));
if (located != null) {return located;}
return super.locate(clazz, path);
}
private String trimFolders(String path) {
return path.substring(path.lastIndexOf("/") + 1);}
}
and in my Page I have
add(JavascriptPackageResource.getHeaderContribution("/myFile.js"));
and of course myFile.js located under /somePath"
what am I missing?
Yohan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org<ma...@wicket.apache.org>
For additional commands, e-mail: users-help@wicket.apache.org<ma...@wicket.apache.org>
Jarosz Yohan
Bioinformatics & Biostatistics Core Facility
EPFL School of Life Sciences
EPFL SV PTECH PTBB
AAB 0 23
Station 15
1015 Lausanne
Switzerland
phone: [+41 21 69] 31439
email: yohan.jarosz@epfl.ch<ma...@epfl.ch>
Re: Loading static javascript
Posted by Martin Makundi <ma...@koodaripalvelut.com>.
This is easier:
response.renderJavascriptReference("/js/jquery.js");
**
Martin
2010/7/15 Jarosz Yohan <yo...@epfl.ch>:
> Hello,
>
> I'm trying to load statatic js files. I 'm using in the init of the application
>
> getResourceSettings().addResourceFolder("/somePath/");
> resourceSettings.setResourceStreamLocator(new RessourceLocator());
>
> with
> public class RessourceLocator extends ResourceStreamLocator{
> public RessourceLocator() {}
> public IResourceStream locate(final Class<?> clazz, final String path) {
> IResourceStream located = super.locate(clazz, trimFolders(path));
> if (located != null) {return located;}
> return super.locate(clazz, path);
> }
> private String trimFolders(String path) {
> return path.substring(path.lastIndexOf("/") + 1);}
> }
>
> and in my Page I have
> add(JavascriptPackageResource.getHeaderContribution("/myFile.js"));
> and of course myFile.js located under /somePath"
>
> what am I missing?
>
> Yohan
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Loading static javascript
Posted by Jarosz Yohan <yo...@epfl.ch>.
Hello,
I'm trying to load statatic js files. I 'm using in the init of the application
getResourceSettings().addResourceFolder("/somePath/");
resourceSettings.setResourceStreamLocator(new RessourceLocator());
with
public class RessourceLocator extends ResourceStreamLocator{
public RessourceLocator() {}
public IResourceStream locate(final Class<?> clazz, final String path) {
IResourceStream located = super.locate(clazz, trimFolders(path));
if (located != null) {return located;}
return super.locate(clazz, path);
}
private String trimFolders(String path) {
return path.substring(path.lastIndexOf("/") + 1);}
}
and in my Page I have
add(JavascriptPackageResource.getHeaderContribution("/myFile.js"));
and of course myFile.js located under /somePath"
what am I missing?
Yohan