You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kshitiz <k....@gmail.com> on 2012/03/29 19:19:38 UTC
StackOverflowError in session creation
Hi,
I am trying to save an object in a session like this:
public class Login extends BasePage {
private static final long serialVersionUID = 1L;
UserDomain userDomain = new UserDomain();
public Login()
{
// form
*StatelessForm loginForm = new StatelessForm ("loginForm", new
CompoundPropertyModel(userDomain));*
add(loginForm);
// emailId field
Label emailIdLabel = new Label("emailIdLabel", "EmailId");
loginForm.add(emailIdLabel);
final RequiredTextField emailId = new RequiredTextField("emailId");
loginForm.add(emailId);
emailId.add(EmailAddressValidator.getInstance());
// password field
Label passwordLabel = new Label("passwordLabel", "Password");
loginForm.add(passwordLabel);
final PasswordTextField password = new
PasswordTextField("password");
loginForm.add(password);
Button submitButton = new Button("submitButton") {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
userDomain.setBlocked(true);
userDomain.setEmaild(emailId.getValue());
userDomain.setPassword(password.getValue());
UserService userService = new UserService();
userDomain = userService.login(userDomain);
* MySession.get().setMyObject(userDomain);*
setResponsePage(Home.class);
}
};
loginForm.add(submitButton);
}
}
My session class is:
public class MySession extends WebSession{
/**
*
*/
private static final long serialVersionUID = 1L;
public MySession(Request request) {
super(request);
// TODO Auto-generated constructor stub
}
private Object myObject;
public final Object getMyObject() {
return myObject;
}
public final void setMyObject(Object myObject) {
this.myObject = myObject;
}
// if you use java >= 1.5 you can make use of covariant return types
* public static MySession get() {
return (MySession)MySession.get();
* }
}
But whenver I try to login into the app, I get the following error:
WicketMessage: Method onFormSubmitted of interface
org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component
[MarkupContainer [Component id = loginForm]] threw an exception
Root cause:
java.lang.StackOverflowError
*at WalknShine.MySession.get(MySession.java:34)*
at WalknShine.MySession.get(MySession.java:34)
at WalknShine.MySession.get(MySession.java:34)
...
Complete stack:
org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of
interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
component [MarkupContainer [Component id = loginForm]] threw an exception
at
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:193)
at
org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents(BookmarkableListenerInterfaceRequestTarget.java:161)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1252)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1331)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1438)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:546)
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
at
org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents(BookmarkableListenerInterfaceRequestTarget.java:161)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1252)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1331)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1438)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:546)
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
What is the reason behind this error....are too many sessions being
created???
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/StackOverflowError-in-session-creation-tp4516170p4516170.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: StackOverflowError in session creation
Posted by kshitiz <k....@gmail.com>.
Oh....I made a stupid mistake....sorry for that and thanks for solving my
problem...
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/StackOverflowError-in-session-creation-tp4516170p4521161.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: StackOverflowError in session creation
Posted by vineet semwal <vi...@gmail.com>.
On Thu, Mar 29, 2012 at 10:49 PM, kshitiz <k....@gmail.com> wrote:
> Hi,
>
> I am trying to save an object in a session like this:
>
>
> public class Login extends BasePage {
>
> private static final long serialVersionUID = 1L;
> UserDomain userDomain = new UserDomain();
>
> public Login()
> {
>
>
> // form
> *StatelessForm loginForm = new StatelessForm ("loginForm", new
> CompoundPropertyModel(userDomain));*
> add(loginForm);
>
> // emailId field
> Label emailIdLabel = new Label("emailIdLabel", "EmailId");
> loginForm.add(emailIdLabel);
> final RequiredTextField emailId = new RequiredTextField("emailId");
> loginForm.add(emailId);
> emailId.add(EmailAddressValidator.getInstance());
>
> // password field
> Label passwordLabel = new Label("passwordLabel", "Password");
> loginForm.add(passwordLabel);
> final PasswordTextField password = new
> PasswordTextField("password");
> loginForm.add(password);
>
> Button submitButton = new Button("submitButton") {
> /**
> *
> */
> private static final long serialVersionUID = 1L;
>
> @Override
> public void onSubmit() {
>
> userDomain.setBlocked(true);
> userDomain.setEmaild(emailId.getValue());
> userDomain.setPassword(password.getValue());
>
> UserService userService = new UserService();
> userDomain = userService.login(userDomain);
>
> * MySession.get().setMyObject(userDomain);*
> setResponsePage(Home.class);
>
> }
> };
>
> loginForm.add(submitButton);
>
>
> }
>
>
>
> }
>
> My session class is:
>
> public class MySession extends WebSession{
>
> /**
> *
> */
> private static final long serialVersionUID = 1L;
>
>
>
> public MySession(Request request) {
> super(request);
> // TODO Auto-generated constructor stub
> }
>
> private Object myObject;
>
>
>
> public final Object getMyObject() {
> return myObject;
> }
>
> public final void setMyObject(Object myObject) {
> this.myObject = myObject;
> }
>
> // if you use java >= 1.5 you can make use of covariant return types
> * public static MySession get() {
> // return (MySession)MySession.get(); <--infinite recursion
return (MySession)Session.get();
> * }
>
> }
>
> But whenver I try to login into the app, I get the following error:
>
> WicketMessage: Method onFormSubmitted of interface
> org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component
> [MarkupContainer [Component id = loginForm]] threw an exception
>
> Root cause:
>
> java.lang.StackOverflowError
> *at WalknShine.MySession.get(MySession.java:34)*
> at WalknShine.MySession.get(MySession.java:34)
> at WalknShine.MySession.get(MySession.java:34)
> ...
> Complete stack:
>
> org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of
> interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
> component [MarkupContainer [Component id = loginForm]] threw an exception
> at
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:193)
> at
> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents(BookmarkableListenerInterfaceRequestTarget.java:161)
> at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
> at
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1252)
> at org.apache.wicket.RequestCycle.step(RequestCycle.java:1331)
> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1438)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:546)
> at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
>
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
> at
> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents(BookmarkableListenerInterfaceRequestTarget.java:161)
> at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
> at
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1252)
> at org.apache.wicket.RequestCycle.step(RequestCycle.java:1331)
> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1438)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:546)
> at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
>
> What is the reason behind this error....are too many sessions being
> created???
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/StackOverflowError-in-session-creation-tp4516170p4516170.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
>
--
thank you,
regards,
Vineet Semwal
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org