try with getWebRequest().getHttpServletRequest().getHttpSession(false)
in your page before making the call to the servlet.
It should return non-null.
Additionally turn on DEBUG logging for WSF

On Sat, Aug 20, 2011 at 12:54 PM,  <martin.ase...@mail.bg> wrote:
>
>
>
> Actually I load a wicket page at root context and obtain a session.
> Afterwards I hit a button that posts to the servlet. I think I'm supposed
> to have HttpSession at the time.
>
>
> Best,
> Martin
>
>
> ----- Цитат от Martin Grigorov (mgrigo...@apache.org), на
> 20.08.2011 в 12:44 -----   the mapping is OK. we see WicketSessionFilter
> in the stack
>
>
> there is the following code in WSF#bindSession():
>
>
>  if (session == null)
>  {
>  if (logger.isDebugEnabled())
>  {
>  logger.debug("could not set Wicket session: key " + sessionKey +
>  " not found in http session for " +
>  ((HttpServletRequest)request).getContextPath() + "," +
> request.getServerName() +
>  ", or http session does not exist");
>  }
>  }
>
>
> Maybe you don't have active HttpSession yet.
>
>
> On Sat, Aug 20, 2011 at 12:24 PM,  wrote:
>
>
> Here is the exception:
>
>
> java.lang.IllegalStateException: you can only locate or create sessions in
> the context of a request cycle
>
>
>  at org.apache.wicket.Session.findOrCreate(Session.java:209)
>
>
>  at org.apache.wicket.Session.get(Session.java:253)
>
>
>  at
> com.company.apps.appname.servlet.FriendsManagerServlet.doPost(FriensManagerServlet.java:39)
>
>
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>
>
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
>
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(AppicationFilterChain.java:290)
>
>
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationilterChain.java:206)
>
>
>  at
> org.apache.wicket.protocol.http.servlet.WicketSessionFilter.doFilter(WicketSessionFilter.java:150)
>
>
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>
>
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>
>
>  at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.jva:370)
>
>
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>
>
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>
>
>  at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>
>
>  at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>
>
>  at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>
>
>  at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>
>
>  at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>
>
>  at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>
>
>  at
> org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864)
>
>
>  at
> org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
>
>
>  at
> org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)
>
>
>  at java.lang.Thread.run(Thread.java:662)
>
>
> ----- Цитат от Martin Grigorov (mgrigo...@apache.org), на
> 20.08.2011 в 12:17 ----- paste the last few lines of the exception
>
>
> On Sat, Aug 20, 2011 at 12:11 PM, wrote:
>
>
> Hi, namesake :)
>
>
> Already tried that, no result.
>
>
> Best,
>
>
> Martin
>
>
> ----- Цитат от Martin Grigorov (mgrigo...@apache.org), на
> 20.08.2011 в 12:09 ----- Try with url-mapping: /friends/* both for the
> session filter and the servlet
>
>
> On Sat, Aug 20, 2011 at 12:03 PM, wrote:
>  Hello, guys,
>
>
> I experience a strange problem with trying to provide a custom servlet
> with
> the wicket session.
>
>
> Here is my web.xml conf:
>
>
>  wicketFilter
>  org.apache.wicket.protocol.http.WicketFilter
>
>
>  applicationClassName
>  com.company.apps.appname.WebApp
>
>
>  filterPath
>  /
>
>
>  wicketFilter
>  /*
>
>
>  wicketSessionFilter
>  org.apache.wicket.protocol.http.servlet.WicketSessionFilter
>
>
>  filterName
>  wicketFilter
>
>
>  wicketSessionFilter
>  /friends
>  REQUEST
>  INCLUDE
>
>
>  friendsManager
>  com.company.apps.appname.servlet.FriendsManagerServlet
>
>
>  friendsManager
>  /friends
>
>
> The exception "java.lang.IllegalStateException: you can only locate or
> create sessions in the context of a request cycle" is being thrown by the
> 'friends' servlet.
>
>
> Everything seems to be configured properly; however I get this error. I'm
> using wicket 1.4.17.
>
>
> I would appreciate any help.
>
>
> Thank you and regards,
> Martin
>
>
> -------------------------------------
>
>
> Видя ли лятната промоция на
> СуперХостинг?
> Дават цели ДВЕ години, като плащаш само
> ЕДНА!
> Истина е, провери!
>  http://www.superhosting.bg/SummerHostingPromo/?utm_source=MailBG&utm_medium=FooterLink&utm_content=SummerPromo123&utm_campaign=SummerPromo
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
> -------------------------------------
>
>
> Виж какво открих...
> Поръчваш си ЕДНА - получаваш цели ДВЕ,
> като втората е бонус!
>  http://www.superhosting.bg/SummerHostingPromo/?utm_source=MailBG&utm_medium=FooterLink&utm_content=SummerPromo124&utm_campaign=SummerPromo
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
> -------------------------------------
>
>
> 50% Отстъпка за Хостинг услуги от ICN.Bg
> Хоствай до 101 сайта на 1 Хостинг и
> Вземи Безплатно Домейн име.
>  http://www.icn.bg/default.icn?show=about&status=about-news&news=173
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
>
>
> -------------------------------------
>
> 50% Отстъпка за Хостинг услуги от ICN.Bg
> Хоствай до 101 сайта на 1 Хостинг и
> Вземи Безплатно Домейн име.
>  http://www.icn.bg/default.icn?show=about&status=about-news&news=173



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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

Reply via email to