You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Mike Scott <mi...@Rightmove.co.uk> on 2002/09/17 18:14:41 UTC
Cookie problem with Turbine 2.1 under Resin 2.1.4
We've been running an application based on Turbine 2.1 in production use
under Tomcat 3.2 for over a year. We're now evaluating Resin 2.1.4 as a
replacement for Tomcat (in search of better performance), and the changes in
the setup seem fairly straightforward except that I'm getting an error
thrown as follows:
Horrible Exception: java.lang.NullPointerException
at
org.apache.turbine.util.parser.DefaultCookieParser.setRunData(DefaultCookieP
arser.java:154)
at
org.apache.turbine.services.rundata.DefaultTurbineRunData.getCookies(Default
TurbineRunData.java:518)
at org.apache.turbine.Turbine.doGet(Turbine.java:279)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:9
6)
at com.caucho.server.http.Invocation.service(Invocation.java:312)
at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:221)
at
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:163)
at com.caucho.server.TcpConnection.run(TcpConnection.java:137)
at java.lang.Thread.run(Thread.java:484)
Turbine seems to have some problem with setting the initial cookies. If I
use a browser with cookies disabled, I get this error every time I try to
load a Turbine page. If I have cookies enabled, I get it the first time, and
if I refresh the page then loads normally, so I guess it's connected with
the session management.
--
Mike Scott
mike.scott@rightmove.co.uk
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs service.
________________________________________________________________________
Re: Cookie problem with Turbine 2.1 under Resin 2.1.4
Posted by Edwin Gustafson <ed...@caymanchem.com>.
Greetings,
Stephane Bailliez's patch from this post...
http://www.mail-archive.com/turbine-dev@jakarta.apache.org/msg05290.html
...fixed the problem for me. The patch gets rid of the assumption that
getCookies() will return a non-null value.
Any idea why this patch hasn't been applied to the trunk? Cookieless
browsing is a pretty fundamental requirement in my project. Surely it
is for others as well?
--
Edwin Gustafson
Cayman Chemical Company
--
734 971 3586 x 221
http://www.caymanchem.com/promo/ewg
42*13'44" N 83*43'25" W
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: AW: AW: trouble extending TemplatePageAttributes
Posted by Scott Eade <se...@backstagetech.com.au>.
> From: "Marc Lustig" <ma...@marclustig.com>
>
> When I don't use any of the methods of my TemplatePageExtendedAttributes
> class in my Default.vm everything works fine. When I include one of the
> methods like the setScript nothing appears except the error message.
> When I comment the one statement in setScript it works fine as well, but
> nothing is put into the head, of course.
> It seems the problem is due to the RunData-field not being initialized
> properly.
>
> Also, your patch appears incomplete since the RunData-field in
> TemplatePageAttributes is declared private. You need to add the field to the
> extended class in order to compile.
> I have to dig further...
I think I understand the problem now. You have to remember that the patch
was for TemplatePageAttributes itself. If you are implementing a class that
extends TemplatePageAttributes then there are a few extra things you need.
To make this easy for you I have attached my TamplatePageAttributesEx class
which I use with my turbine 2.1 based application.
Cheers,
Scott
--
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
AW: AW: trouble extending TemplatePageAttributes
Posted by Marc Lustig <ma...@marclustig.com>.
> -----Ursprungliche Nachricht-----
> Von: Scott Eade [mailto:seade@backstagetech.com.au]
> Gesendet: Donnerstag, 19. September 2002 01:00
> An: turbine-user
> Betreff: Re: AW: trouble extending TemplatePageAttributes
>
>
> > From: "Marc Lustig" <ma...@marclustig.com>
> >
> > $page.setScript($content.getURI("resources/audiotex.js"))
> >
> This is how I use the setScript() method that I have added to my extended
> TemplatePageAttributes.
>
> Everything else looks okay, but I am wondering how your page renders when
> the template does not include the above line - in particular, does the
> rendered html include a <head> element?
When I don't use any of the methods of my TemplatePageExtendedAttributes
class in my Default.vm everything works fine. When I include one of the
methods like the setScript nothing appears except the error message.
When I comment the one statement in setScript it works fine as well, but
nothing is put into the head, of course.
It seems the problem is due to the RunData-field not being initialized
properly.
Also, your patch appears incomplete since the RunData-field in
TemplatePageAttributes is declared private. You need to add the field to the
extended class in order to compile.
I have to dig further...
Marc
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: AW: trouble extending TemplatePageAttributes
Posted by Scott Eade <se...@backstagetech.com.au>.
> From: "Marc Lustig" <ma...@marclustig.com>
>
> $page.setScript($content.getURI("resources/audiotex.js"))
>
This is how I use the setScript() method that I have added to my extended
TemplatePageAttributes.
Everything else looks okay, but I am wondering how your page renders when
the template does not include the above line - in particular, does the
rendered html include a <head> element?
The setScript() method I provided is pretty small. It shouldn't be too
difficult to add a few debugging statements to figure out where the problem
is coming from.
HTH,
Scott
--
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
AW: trouble extending TemplatePageAttributes
Posted by Marc Lustig <ma...@marclustig.com>.
There was an error in my own posting from today:
of course the entry in TR.props is
tool.request.page=de.geoconnect.audiotex.turbineext.TemplatePageExtendedAttributes
and not
tool.request.page=org.apache.turbine.util.template.TemplatePageExtendedAttributes
And I also tried
$page.setScript($content.getURI("resources/audiotex.js"))
instead of
> $page.setScript("resources/audiotex.js")
but still get the same error:
> Horrible Exception:
> org.apache.velocity.exception.MethodInvocationException:
> Invocation of method 'setScript' in class
> de.geoconnect.audiotex.turbineext.TemplatePageExtendedAttributes
> threw exception class java.lang.NullPointerException : null
Anybody having a hint for me?
Thanks!
Marc
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
trouble extending TemplatePageAttributes
Posted by Marc Lustig <ma...@marclustig.com>.
Hi again,
I extended TemplatePageAttributes with TemplatePageExtendedAttributes to include some new methods:
package de.geoconnect.audiotex.turbineext;
public class TemplatePageExtendedAttributes extends TemplatePageAttributes implements ApplicationTool
{
...
public TemplatePageAttributes setScript(String url)
{
data.getPage().getHead().addElement(new Script().setSrc(url)
.setType("text/javascript").setLanguage("JavaScript"));
return this;
}
}
... and modified the corresponding entry in TR.props:
tool.request.page=org.apache.turbine.util.template.TemplatePageExtendedAttributes
Now, when accessing my new method in my Default.vm template
$page.setScript("resources/audiotex.js")
I get the following error:
Horrible Exception: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'setScript' in class de.geoconnect.audiotex.turbineext.TemplatePageExtendedAttributes threw exception class java.lang.NullPointerException : null
I have placed the file audiotex.js in webapps\resources.
What's wrong here?
I'm grateful for any hint.
Marc
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Cookie problem with Turbine 2.1 under Resin 2.1.4
Posted by Edwin Gustafson <ed...@caymanchem.com>.
Greetings,
I've seen similar behavior under Tomcat. Here's what I've found:
This thread
http://www.mail-archive.com/turbine-user@jakarta.apache.org/msg05846.html
from January seemed to narrow the problem to DefaultCookieParser and
pointed the way to a solution. However, that solution isn't present in
CVS for either turbine-2 or fulcrum.
The specific problem cited is that DefaultCookieParser doesn't account
for the possibility that the request's getCookies method might return
null. This can happen if no cookies are sent with the request, such as
when the browser doesn't accept cookies or when there just aren't any
cookies. See
http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletRequest.html#getCookies()
I'm going to test this hypothesis by writing my own (patched) cookie
parser. I'll post my results when available, hopefully by the end of
the week.
Mike Scott wrote:
>We've been running an application based on Turbine 2.1 in production use
>under Tomcat 3.2 for over a year. We're now evaluating Resin 2.1.4 as a
>replacement for Tomcat (in search of better performance), and the changes in
>the setup seem fairly straightforward except that I'm getting an error
>thrown as follows:
>
>Horrible Exception: java.lang.NullPointerException
> at
>org.apache.turbine.util.parser.DefaultCookieParser.setRunData(DefaultCookieP
>arser.java:154)
> at
>org.apache.turbine.services.rundata.DefaultTurbineRunData.getCookies(Default
>TurbineRunData.java:518)
> at org.apache.turbine.Turbine.doGet(Turbine.java:279)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:9
>6)
> at com.caucho.server.http.Invocation.service(Invocation.java:312)
> at
>com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:221)
> at
>com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:163)
> at com.caucho.server.TcpConnection.run(TcpConnection.java:137)
> at java.lang.Thread.run(Thread.java:484)
>
>Turbine seems to have some problem with setting the initial cookies. If I
>use a browser with cookies disabled, I get this error every time I try to
>load a Turbine page. If I have cookies enabled, I get it the first time, and
>if I refresh the page then loads normally, so I guess it's connected with
>the session management.
>
>
>
--
Edwin Gustafson
Cayman Chemical Company
--
734 971 3586 x 221
http://www.caymanchem.com/promo/ewg
42*13'44" N 83*43'25" W
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>