ahh are you saying that you get that errors
when there is no request happening?
that pages get these events when they are just in the page map?
Yes then there is no request cycle.

johan


Dzenan Ridjanovic wrote:
Hi,

This is my guess only, why I have null pointer exception in
setResponsePage:

I use Observer/Observable for controlling the flow of pages.
This allows me to reuse forms in different contexts since
there is no setResponsePage in onSubmit.

For example:

public final class UrlsPage extends MemberWebPage implements Observer {

// urls is a collection that I will use to do url changes
private Urls urls;

public UrlsPage(final Category category) {
       this.category = category;
       urls = category.getUrls();
       urls.addObserver(this);
       List urlsList = urls.getList();
   createPageComponents(urlsList, urls);
   }

public void update(Observable o, Object arg) {
     if (o instanceof Urls) {
         urls.deleteObserver(this);
                  // categoris with their urls are saved in an XML file
         UrlsApp app = (UrlsApp) getApplication();
       Categories entryCategories = app.getUrlsDb().getCategories();
       entryCategories.save();
              // line 99 where the error happens
       setResponsePage(new UrlsPage(category));
     }
 }

When a url change happens somewhere else, the update method
is called and I save changes to an XML file.
The next page is this one but "refreshed" to reflect changes.
Between urls.addObserver(this); here and, for example, url edit
somewhere else, there may be other pages with panels and forms.
Since Wicket keeps a certain number of pages in memory, it seems
to me (only my guess) that somehow this UrlsPage "looses"
its request cycle.

However, it may be that I am doing something terribly wrong that
I am not aware.

wicket.WicketRuntimeException: Method public abstract void wicket.markup.html.form.IFormSubmitListener.onFormSubmitted() of interface java.lang.reflect.Method threw an exception at wicket.protocol.http.WebRequestCycle.invokeInterface(WebRequestCycle.java:506) at wicket.protocol.http.WebRequestCycle.invokeInterface(WebRequestCycle.java:562) at wicket.protocol.http.WebRequestCycle.callComponentListener(WebRequestCycle.java:420) at wicket.protocol.http.WebRequestCycle.parseRequest(WebRequestCycle.java:129)
   at wicket.RequestCycle.request(RequestCycle.java:403)
   at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:304)
   at wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:328)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:731) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
at wicket.protocol.http.WebRequestCycle.invokeInterface(WebRequestCycle.java:497)
   ... 22 more
Caused by: java.lang.NullPointerException
   at wicket.Component.setResponsePage(Component.java:1214)
   at org.wicket.urls.app.view.url.UrlsPage.update(UrlsPage.java:99)
   at java.util.Observable.notifyObservers(Observable.java:142)
   at org.dzenanr.model.Entities.notifyObservers(Entities.java:795)
   at org.dzenanr.model.Entities.update(Entities.java:526)
at org.wicket.urls.app.view.url.UrlEditForm.onSubmit(UrlEditForm.java:53)
   at wicket.markup.html.form.Form.delegateSubmit(Form.java:428)
   at wicket.markup.html.form.Form.process(Form.java:380)
   at wicket.markup.html.form.Form.onFormSubmitted(Form.java:212)
   ... 26 more

To reproduce this error go to the Urls application at

http://drdb.fsa.ulaval.ca/urls12/app

Click on the Categories link.
Login as (dr, dr).
Click on the Urls link for the Framework category.
Edit and save any of the two urls.

Every single time you get the error (with the edit saved).

Dzenan




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to