Re: java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle even through WicketSessionFilter

2011-08-20 Thread Martin Grigorov
Try with url-mapping: /friends/* both for the session filter and the servlet

On Sat, Aug 20, 2011 at 12:03 PM,  martin.ase...@mail.bg 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:

 filter
        filter-namewicketFilter/filter-name
        
 filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
        init-param
                param-nameapplicationClassName/param-name
                param-valuecom.company.apps.appname.WebApp/param-value
        /init-param
        init-param
                param-namefilterPath/param-name
                param-value//param-value
        /init-param
 /filter

 filter-mapping
        filter-namewicketFilter/filter-name
        url-pattern/*/url-pattern
 /filter-mapping

 filter
  filter-namewicketSessionFilter/filter-name
  filter-classorg.apache.wicket.protocol.http.servlet.WicketSessionFilter/filter-class
  init-param
    param-namefilterName/param-name
    param-valuewicketFilter/param-value
  /init-param
 /filter

 filter-mapping
  filter-namewicketSessionFilter/filter-name
  url-pattern/friends/url-pattern
  dispatcherREQUEST/dispatcher
  dispatcherINCLUDE/dispatcher
 /filter-mapping

 servlet
        servlet-namefriendsManager/servlet-name
        
 servlet-classcom.company.apps.appname.servlet.FriendsManagerServlet/servlet-class
 /servlet

 servlet-mapping
        servlet-namefriendsManager/servlet-name
        url-pattern/friends/url-pattern
 /servlet-mapping

 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=MailBGutm_medium=FooterLinkutm_content=SummerPromo123utm_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



Re: java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle even through WicketSessionFilter

2011-08-20 Thread martin . asenov



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=MailBGutm_medium=FooterLinkutm_content=SummerPromo123utm_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=MailBGutm_medium=FooterLinkutm_content=SummerPromo124utm_campaign=SummerPromo

Re: java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle even through WicketSessionFilter

2011-08-20 Thread Martin Grigorov
paste the last few lines of the exception

On Sat, Aug 20, 2011 at 12:11 PM,  martin.ase...@mail.bg 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=MailBGutm_medium=FooterLinkutm_content=SummerPromo123utm_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=MailBGutm_medium=FooterLinkutm_content=SummerPromo124utm_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



Re: java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle even through WicketSessionFilter

2011-08-20 Thread martin . asenov



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=MailBGutm_medium=FooterLinkutm_content=SummerPromo123utm_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=MailBGutm_medium=FooterLinkutm_content=SummerPromo124utm_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=aboutstatus=about-newsnews=173

Re: java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle even through WicketSessionFilter

2011-08-20 Thread Martin Grigorov
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,  martin.ase...@mail.bg 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=MailBGutm_medium=FooterLinkutm_content=SummerPromo123utm_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


 -


 Виж какво открих...
 Поръчваш си ЕДНА - получаваш цели ДВЕ,
 като 

Re: java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle even through WicketSessionFilter

2011-08-20 Thread martin . asenov



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=MailBGutm_medium=FooterLinkutm_content=SummerPromo123utm_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


-


Виж какво открих...
Поръчваш си ЕДНА - получаваш цели ДВЕ,
като втората е бонус!
 

Re: java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle even through WicketSessionFilter

2011-08-20 Thread Martin Grigorov
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=MailBGutm_medium=FooterLinkutm_content=SummerPromo123utm_campaign=SummerPromo


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


 

Re: java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle even through WicketSessionFilter

2011-08-20 Thread martin . asenov



yes, really session is null :O 


at servlet: 


req.getSession() returns null 


and wicketsessionfilter in debug mode prints 


20-08-2011 13:25:57,753 DEBUG
org.apache.wicket.protocol.http.servlet.WicketSessionFilter.bindSession:180
- could not set Wicket session: key null not found in http session for
/appname,IP_ADDRESS, or http session does not exist 


I really don't get it... null http session... could this really be true? 


Best,
Martin  


- Цитат от Martin Grigorov (mgrigo...@apache.org), на
20.08.2011 в 13:16 -   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,  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



Re: java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle even through WicketSessionFilter

2011-08-20 Thread martin . asenov



Sorry, my mistake... 


Session is not null at servlet. There I have: 


session is: org.apache.catalina.session.StandardSessionFacade@412f4b 


while the statement in logs from wicketsessionfilter is: 


20-08-2011 13:25:57,753 DEBUG
org.apache.wicket.protocol.http.servlet.WicketSessionFilter.bindSession:180
- could not set Wicket session: key null not found in http session for
/appname,IP_ADDRESS, or http session does not exist 


- Цитат от martin.ase...@mail.bg, на 20.08.2011 в 13:31 -
  


yes, really session is null :O 


at servlet: 


req.getSession() returns null 


and wicketsessionfilter in debug mode prints 


20-08-2011 13:25:57,753 DEBUG
org.apache.wicket.protocol.http.servlet.WicketSessionFilter.bindSession:180
- could not set Wicket session: key null not found in http session for
/appname,IP_ADDRESS, or http session does not exist 


I really don't get it... null http session... could this really be true? 


Best,
Martin 


- Цитат от Martin Grigorov (mgrigo...@apache.org), на
20.08.2011 в 13:16 - 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, 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
 

Re: java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle even through WicketSessionFilter

2011-08-20 Thread martin . asenov



In the page, which calls the servlet afterwards,
getWebRequestCycle().getWebRequest().getHttpServletRequest().getSession(false)
returns null 


Do you have any ideas why this occurs? 


Thank you,
Martin  


- Цитат от Martin Grigorov (mgrigo...@apache.org), на
20.08.2011 в 13:16 -   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,  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


-


Видя ли лятната промоция на
СуперХостинг?
Дават цели ДВЕ години, като плащаш само
ЕДНА!
Истина е, провери!
 

Re: java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle even through WicketSessionFilter

2011-08-20 Thread Martin Grigorov
Call Session.get().bind() before the POST call and it will be fine.

On Sat, Aug 20, 2011 at 1:57 PM,  martin.ase...@mail.bg wrote:



 In the page, which calls the servlet afterwards,
 getWebRequestCycle().getWebRequest().getHttpServletRequest().getSession(false)
 returns null


 Do you have any ideas why this occurs?


 Thank you,
 Martin


 - Цитат от Martin Grigorov (mgrigo...@apache.org), на
 20.08.2011 в 13:16 -   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,  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


 

Re: java.lang.IllegalStateException: you can only locate or create sessions in the context of a request cycle even through WicketSessionFilter

2011-08-20 Thread martin . asenov



Thanks a lot for your time, it did the trick :) 


Best regards,
Martin  


- Цитат от Martin Grigorov (mgrigo...@apache.org), на
20.08.2011 в 14:31 -   Call Session.get().bind() before the POST call
and it will be fine.


On Sat, Aug 20, 2011 at 1:57 PM,  wrote:


In the page, which calls the servlet afterwards,
getWebRequestCycle().getWebRequest().getHttpServletRequest().getSession(false)
returns null


Do you have any ideas why this occurs?


Thank you,
Martin


- Цитат от Martin Grigorov (mgrigo...@apache.org), на
20.08.2011 в 13:16 - 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, 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