users@glassfish.java.net

CoyoteResponse throws NullPointerException on sendRedirect (sporadically)

From: <glassfish_at_javadesktop.org>
Date: Mon, 02 Mar 2009 13:34:04 PST

Hi,

We are seeing an issue where an error is sometimes thrown when calling sendRedirect, but not always. When it does, we see the following the stack trace:

java.lang.NullPointerException
at org.apache.coyote.tomcat5.CoyoteResponse.toAbsolute(CoyoteResponse.java:1610)
at org.apache.coyote.tomcat5.CoyoteResponse.sendRedirect(CoyoteResponse.java:1359)
at org.apache.coyote.tomcat5.CoyoteResponseFacade.sendRedirect(CoyoteResponseFacade.java:468)
...

Now we are not doing anything fancy here, just calling a sendRedirect on the response, passing a (relative) location.

I looked into the glassfish source a little and it seems the problem is here:

    protected String toAbsolute(String location) {
            ...
            String scheme = request.getScheme();
            ...
            try {
                redirectURLCC.append(scheme, 0, scheme.length());

So for some reason request.getScheme returns null. Does any one have an ideas why this might be? Could it be something we're doing incorrectly, or is this a glassfish issue?

Thanks,
Gustavo
[Message sent by forum member 'scolapasta' (scolapasta)]

http://forums.java.net/jive/thread.jspa?messageID=334667