You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by "Brette, Marc" <Ma...@mkms.xerox.com> on 2002/04/29 17:09:46 UTC

HttpSession does not exists

Hi,
I have just updated to Cactus 1.3 and the following code throws an exception
:

public class Testresults extends JspTestCase {
...
  protected void setUp() throws Exception { 
    // Setup the needed beans
    // JSPDataConstants.initializeConstants(pageContext) ;
    SessionBean sessionBean = new SessionBean() ;
    pageContext.setAttribute("sessionBean",
sessionBean,PageContext.SESSION_SCOPE) ;
  }
...
java.lang.IllegalArgumentException: can't access SESSION_SCOPE without an
HttpSession
 at
org.apache.jasper.runtime.PageContextImpl.setAttribute(PageContextImpl.java:
244)
 at
org.apache.cactus.server.AbstractPageContextWrapper.dispatch63_setAttribute
AbstractPageContextWrapper.java;org/apache/cactus/util/log/LogAspect.java(1k
):319)
 at
org.apache.cactus.server.AbstractPageContextWrapper.around63_setAttribute(Ab
stractPageContextWrapper.java;org/apache/cactus/util/log/LogAspect.java(1k):
1147)
 at
org.apache.cactus.server.AbstractPageContextWrapper.setAttribute(AbstractPag
eContextWrapper.java;org/apache/cactus/util/log/LogAspect.java(1k):316)
 at Testresults.setUp(Testresults.java:86)
 at
org.apache.cactus.AbstractTestCase.runBareServerTest(AbstractTestCase.java:4
88)
 at
org.apache.cactus.server.AbstractTestCaller.doTest(AbstractTestCaller.java:1
48)
...

It worked with Cactus previous version, but I remember I had to change the
jspRedirector.jsp first line to
<%@page import="org.apache.cactus.server.*" session="true" %> (the original
version states session="false")

I made this change because I had a similar exception and saw this advice on
cactus mailing list.
But now, it seems obvious that I don't correctly use Cactus.
Could you help, please ?

--Marc

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: HttpSession does not exists

Posted by Vincent Massol <vm...@octo.com>.
Marc,

This looks like a bug to me. Can you raise a bug using the bugzilla link
on the Cactus web page. That would prevent us from forgetting it next
time.

In the meantime, I guess putting : session="true" will make it work,
right ?

I do think you use Cactus correctly but simply that this bug was not
fixed in Cactus 1.3 ... 

Thanks for your help
-Vincent

> -----Original Message-----
> From: Brette, Marc [mailto:Marc.Brette@mkms.xerox.com]
> Sent: 29 April 2002 16:10
> To: cactus-user@jakarta.apache.org
> Subject: HttpSession does not exists
> 
> Hi,
> I have just updated to Cactus 1.3 and the following code throws an
> exception
> :
> 
> public class Testresults extends JspTestCase {
> ...
>   protected void setUp() throws Exception {
>     // Setup the needed beans
>     // JSPDataConstants.initializeConstants(pageContext) ;
>     SessionBean sessionBean = new SessionBean() ;
>     pageContext.setAttribute("sessionBean",
> sessionBean,PageContext.SESSION_SCOPE) ;
>   }
> ...
> java.lang.IllegalArgumentException: can't access SESSION_SCOPE without
an
> HttpSession
>  at
>
org.apache.jasper.runtime.PageContextImpl.setAttribute(PageContextImpl.j
av
> a:
> 244)
>  at
>
org.apache.cactus.server.AbstractPageContextWrapper.dispatch63_setAttrib
ut
> e
>
AbstractPageContextWrapper.java;org/apache/cactus/util/log/LogAspect.jav
a(
> 1k
> ):319)
>  at
>
org.apache.cactus.server.AbstractPageContextWrapper.around63_setAttribut
e(
> Ab
>
stractPageContextWrapper.java;org/apache/cactus/util/log/LogAspect.java(
1k
> ):
> 1147)
>  at
>
org.apache.cactus.server.AbstractPageContextWrapper.setAttribute(Abstrac
tP
> ag
>
eContextWrapper.java;org/apache/cactus/util/log/LogAspect.java(1k):316)
>  at Testresults.setUp(Testresults.java:86)
>  at
>
org.apache.cactus.AbstractTestCase.runBareServerTest(AbstractTestCase.ja
va
> :4
> 88)
>  at
>
org.apache.cactus.server.AbstractTestCaller.doTest(AbstractTestCaller.ja
va
> :1
> 48)
> ...
> 
> It worked with Cactus previous version, but I remember I had to change
the
> jspRedirector.jsp first line to
> <%@page import="org.apache.cactus.server.*" session="true" %> (the
> original
> version states session="false")
> 
> I made this change because I had a similar exception and saw this
advice
> on
> cactus mailing list.
> But now, it seems obvious that I don't correctly use Cactus.
> Could you help, please ?
> 
> --Marc
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>