You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Alec Bickerton <al...@minick.ch> on 2008/04/03 18:30:52 UTC
RequestWrapper and the case of the Nullpointer
Hi,
I'm seeing a problem with cocoon requests. When our application attempts
to read a parameter from the request a NullpointerException is thrown.
I can't be more specific because this ONLY occurs when tomcat is started
without a debugger. If I attach the debugger, it seem that the
RequestWrapper initialises correctly and the parameter is found.
This is in cocoon 2.1.9, has anyone seen this before? Any ideas how I
can prevent it happening through a configuration value?
Thanks,
Alec
The offending method
public String getParameter(String name) {
String value = this.parameters.getParameter(name);
if (value == null && this.rawMode == false)
return this.req.getParameter(name);
else
return value;
}
And here's a stacktrace too.
java.lang.NullPointerException at
org.apache.catalina.connector.Request.parseParameters(Request.java:2426) at
org.apache.catalina.connector.Request.getParameter(Request.java:1040)
at
org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:355)
at
org.apache.cocoon.environment.http.HttpRequest.getParameter(HttpRequest.java:316)
at
org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
at
org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
at
org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
at
org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
at
org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
at
org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
at
org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
at
ch.minick.portal.cocoon.environment.HttpServletRequestAdapter.getParameter(HttpServletRequestAdapter.java:160)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: RequestWrapper and the case of the Nullpointer
Posted by jsfbee <kj...@rediffmail.com>.
I am also getting the same error. I am using JSF and Tomcat 5.5.
It comes on and off. Not consistent. Pulling my hair!!!
Vadim Gritsenko wrote:
>
> On Apr 4, 2008, at 5:38 AM, Alec Bickerton wrote:
>
>> Vadim Gritsenko wrote:
>>> On Apr 3, 2008, at 12:30 PM, Alec Bickerton wrote:
>> [snip]
>>>> I can't be more specific because this ONLY occurs when tomcat is
>>>> started without a debugger. If I attach the debugger, it seem that
>>>> the RequestWrapper initialises correctly and the parameter is found.
>> [snip]
>>> Did you check tomcat's source code for the version you are running?
>>> I'm curious what is at this line
>>>
>>> catalina.connector.Request.parseParameters(Request.java:2426)
>>
>>
>>> Without knowing code at that line, I can only guess that there is
>>> something wrong with incoming request and tomcat fails to parse it...
>> I hadn't so I did a little bit of digging through the Tomcat 6.0.14
>> source over the evening. It gets more interesting as the code at
>> org.apache.catalina.connector.Request.parseParameters(Request.java:
>> 2426)
>> is shown below.
>>
>> if (!getMethod().equalsIgnoreCase("POST"))
>> return;
>>
>> for completeness...
>>
>> /**
>> * Return the HTTP request method used in this Request.
>> */
>> public String getMethod() {
>> return coyoteRequest.method().toString();
>> }
>>
>> ... Coyote.Request
>
> Assuming coyoteRequest is instance of Coyote.Request class...
>
>
>> public MessageBytes method() {
>> return methodMB; <-- This value is initialised in the class
>> declaration.
>> }
>
> I think from here you should be looking for MessageBytes.toString()
> method, and not Request.toString()...
>
>
>> public MessageBytes requestURI() {
>> return uriMB;<-- This value is initialised in the class
>> declaration.
>> }
>>
>> public String toString() {
>> return "R( " + requestURI().toString() + ")";
>> }
>>
>> Unless I'm being a bit thick, it doesn't explain why the getMethod()
>> appears to sometimes return null.
>>
>> The Java version being used is java version "1.6.0_05" server
>>
>> One for the tomcat mailing list I think.
>
> Probably yes
>
> Vadim
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/RequestWrapper-and-the-case-of-the-Nullpointer-tp16478790p18495515.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: RequestWrapper and the case of the Nullpointer
Posted by Vadim Gritsenko <va...@reverycodes.com>.
On Apr 4, 2008, at 5:38 AM, Alec Bickerton wrote:
> Vadim Gritsenko wrote:
>> On Apr 3, 2008, at 12:30 PM, Alec Bickerton wrote:
> [snip]
>>> I can't be more specific because this ONLY occurs when tomcat is
>>> started without a debugger. If I attach the debugger, it seem that
>>> the RequestWrapper initialises correctly and the parameter is found.
> [snip]
>> Did you check tomcat's source code for the version you are running?
>> I'm curious what is at this line
>>
>> catalina.connector.Request.parseParameters(Request.java:2426)
>
>
>> Without knowing code at that line, I can only guess that there is
>> something wrong with incoming request and tomcat fails to parse it...
> I hadn't so I did a little bit of digging through the Tomcat 6.0.14
> source over the evening. It gets more interesting as the code at
> org.apache.catalina.connector.Request.parseParameters(Request.java:
> 2426)
> is shown below.
>
> if (!getMethod().equalsIgnoreCase("POST"))
> return;
>
> for completeness...
>
> /**
> * Return the HTTP request method used in this Request.
> */
> public String getMethod() {
> return coyoteRequest.method().toString();
> }
>
> ... Coyote.Request
Assuming coyoteRequest is instance of Coyote.Request class...
> public MessageBytes method() {
> return methodMB; <-- This value is initialised in the class
> declaration.
> }
I think from here you should be looking for MessageBytes.toString()
method, and not Request.toString()...
> public MessageBytes requestURI() {
> return uriMB;<-- This value is initialised in the class
> declaration.
> }
>
> public String toString() {
> return "R( " + requestURI().toString() + ")";
> }
>
> Unless I'm being a bit thick, it doesn't explain why the getMethod()
> appears to sometimes return null.
>
> The Java version being used is java version "1.6.0_05" server
>
> One for the tomcat mailing list I think.
Probably yes
Vadim
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: RequestWrapper and the case of the Nullpointer
Posted by Alec Bickerton <al...@minick.ch>.
Vadim Gritsenko wrote:
> On Apr 3, 2008, at 12:30 PM, Alec Bickerton wrote:
[snip]
>> I can't be more specific because this ONLY occurs when tomcat is
>> started without a debugger. If I attach the debugger, it seem that the
>> RequestWrapper initialises correctly and the parameter is found.
[snip]
>
> Did you check tomcat's source code for the version you are running? I'm
> curious what is at this line
>
>java.lang.NullPointerException at org.apache.catalina.connector.Request.parseParameters(Request.java:2426) at org.apache.catalina.connector.Request.getParameter(Request.java:1040) at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:355) at org.apache.cocoon.environment.http.HttpRequest.getParameter(HttpRequest.java:316) at org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
>at org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
>at org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
>at org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
>at org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
>at org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
>at org.apache.cocoon.environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:123)
>at ch.minick.portal.cocoon.environment.HttpServletRequestAdapter.getParameter(HttpServletRequestAdapter.java:160) catalina.connector.Request.parseParameters(Request.java:2426)
> Without knowing code at that line, I can only guess that there is
> something wrong with incoming request and tomcat fails to parse it...
I hadn't so I did a little bit of digging through the Tomcat 6.0.14
source over the evening. It gets more interesting as the code at
org.apache.catalina.connector.Request.parseParameters(Request.java:2426)
is shown below.
if (!getMethod().equalsIgnoreCase("POST"))
return;
for completeness...
/**
* Return the HTTP request method used in this Request.
*/
public String getMethod() {
return coyoteRequest.method().toString();
}
... Coyote.Request
public MessageBytes method() {
return methodMB; <-- This value is initialised in the class
declaration.
}
public MessageBytes requestURI() {
return uriMB;<-- This value is initialised in the class
declaration.
}
public String toString() {
return "R( " + requestURI().toString() + ")";
}
Unless I'm being a bit thick, it doesn't explain why the getMethod()
appears to sometimes return null.
The Java version being used is java version "1.6.0_05" server
One for the tomcat mailing list I think.
Alec
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: RequestWrapper and the case of the Nullpointer
Posted by Vadim Gritsenko <va...@reverycodes.com>.
On Apr 3, 2008, at 12:30 PM, Alec Bickerton wrote:
> I'm seeing a problem with cocoon requests. When our application
> attempts to read a parameter from the request a NullpointerException
> is thrown.
>
> I can't be more specific because this ONLY occurs when tomcat is
> started without a debugger. If I attach the debugger, it seem that
> the RequestWrapper initialises correctly and the parameter is found.
>
> This is in cocoon 2.1.9, has anyone seen this before? Any ideas how
> I can prevent it happening through a configuration value?
Did you check tomcat's source code for the version you are running?
I'm curious what is at this line
at
org.apache.catalina.connector.Request.parseParameters(Request.java:2426)
Without knowing code at that line, I can only guess that there is
something wrong with incoming request and tomcat fails to parse it...
Vadim
> Thanks,
> Alec
>
> The offending method
>
> public String getParameter(String name) {
> String value = this.parameters.getParameter(name);
> if (value == null && this.rawMode == false)
> return this.req.getParameter(name);
> else
> return value;
> }
>
>
> And here's a stacktrace too.
>
>
> java.lang.NullPointerException at
> org.apache.catalina.connector.Request.parseParameters(Request.java:
> 2426) at
> org.apache.catalina.connector.Request.getParameter(Request.java:
> 1040) at
> org
> .apache
> .catalina.connector.RequestFacade.getParameter(RequestFacade.java:
> 355) at
> org
> .apache
> .cocoon.environment.http.HttpRequest.getParameter(HttpRequest.java:
> 316) at
> org
> .apache
> .cocoon
> .environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:
> 123)
> at
> org
> .apache
> .cocoon
> .environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:
> 123)
> at
> org
> .apache
> .cocoon
> .environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:
> 123)
> at
> org
> .apache
> .cocoon
> .environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:
> 123)
> at
> org
> .apache
> .cocoon
> .environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:
> 123)
> at
> org
> .apache
> .cocoon
> .environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:
> 123)
> at
> org
> .apache
> .cocoon
> .environment.wrapper.RequestWrapper.getParameter(RequestWrapper.java:
> 123)
> at
> ch
> .minick
> .portal
> .cocoon
> .environment
> .HttpServletRequestAdapter
> .getParameter(HttpServletRequestAdapter.java:160)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org