You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Simon Raveh <si...@icann.org> on 2012/05/09 21:02:15 UTC

Null Pointer Exception

Hi All,

I have a Tapestry 5.2.6 Application in production running on Tomcat 7. In
general everything is running smoothly but from time to time I get the
exception below. I did not get any user complain related to it, so I can't
really attached it to any specific operation a user does. I did not see this
exception in dev or in any of my automated testing.
I will really appreciate it if some one can point me / guide me on where to
start digging to find the cause.

The Exception:

java.lang.NullPointerException

     at java.io.FilterInputStream.close(Unknown Source)
     at 
sun.net.www.protocol.jar.JarURLConnection$JarURLInputStream.close(Unknown
Source)

     at java.io.BufferedInputStream.close(Unknown Source)
     at 
org.apache.tapestry5.ioc.internal.util.InternalUtils.close(InternalUtils.jav
a:791)

     at 
org.apache.tapestry5.internal.services.ResourceStreamerImpl.streamResource(R
esourceStreamerImpl.java:158)

     at 
$ResourceStreamer_13730ce28a6.streamResource($ResourceStreamer_13730ce28a6.j
ava)

     at 
org.apache.tapestry5.internal.services.assets.ClasspathAssetRequestHandler.h
andleAssetRequest(ClasspathAssetRequestHandler.java:58)

     at 
org.apache.tapestry5.internal.services.AssetDispatcher.dispatch(AssetDispatc
her.java:80)

     at $Dispatcher_13730ce28a3.dispatch($Dispatcher_13730ce28a3.java)
     at $Dispatcher_13730ce28a8.dispatch($Dispatcher_13730ce28a8.java)
     at $Dispatcher_13730ce28a1.dispatch($Dispatcher_13730ce28a1.java)
     at 
org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.servic
e(TapestryModule.java:321)

     at 
org.icann.gtld.tas.web.common.services.CommonsModule$1.service(CommonsModule
.java:83)

     at $RequestFilter_13730ce28a0.service($RequestFilter_13730ce28a0.java)
     at 
$RequestHandler_13730ce28a2.service($RequestHandler_13730ce28a2.java)
     at 
org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErr
orFilter.java:26)

     at 
$RequestHandler_13730ce28a2.service($RequestHandler_13730ce28a2.java)
     at 
org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:9
84)

     at 
$RequestHandler_13730ce28a2.service($RequestHandler_13730ce28a2.java)
     at 
org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:9
74)

     at 
$RequestHandler_13730ce28a2.service($RequestHandler_13730ce28a2.java)
     at 
org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFiles
Filter.java:90)

     at 
$RequestHandler_13730ce28a2.service($RequestHandler_13730ce28a2.java)
     at 
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckF
orUpdatesFilter.java:90)

     at 
org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckF
orUpdatesFilter.java:80)

     at 
org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(Concurrent
Barrier.java:85)

     at 
org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckFo
rUpdatesFilter.java:103)

     at 
$RequestHandler_13730ce28a2.service($RequestHandler_13730ce28a2.java)
     at 
$RequestHandler_13730ce2897.service($RequestHandler_13730ce2897.java)
     at 
org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTermin
ator.service(TapestryModule.java:272)

     at 
org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)

     at 
$HttpServletRequestHandler_13730ce2899.service($HttpServletRequestHandler_13
730ce2899.java)

     at 
org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.
service(MultipartServletRequestFilter.java:44)

     at 
$HttpServletRequestHandler_13730ce2899.service($HttpServletRequestHandler_13
730ce2899.java)

     at 
org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPat
hsFilter.java:62)

     at 
$HttpServletRequestFilter_13730ce2896.service($HttpServletRequestFilter_1373
0ce2896.java)

     at 
$HttpServletRequestHandler_13730ce2899.service($HttpServletRequestHandler_13
730ce2899.java)

     at 
org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:9
28)

     at 
$HttpServletRequestHandler_13730ce2899.service($HttpServletRequestHandler_13
730ce2899.java)

     at 
$HttpServletRequestHandler_13730ce2893.service($HttpServletRequestHandler_13
730ce2893.java)

     at 
org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:147)
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:243)

     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:210)

     at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:224)

     at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:169)

     at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:472)

     at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168
)

     at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)

     at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)

     at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:118)

     at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)

     at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Proce
ssor.java:987)

     at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(Abstrac
tProtocol.java:539)

     at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:
298)

     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
     at java.lang.Thread.run(Unknown Source)

Thanks,
Simon  

 



Re: Null Pointer Exception

Posted by Felix Gonschorek <fe...@netzgut.net>.
i am getting this error (NPE in FilterInputStream.close()) when a bot or
crawler tries to access an invalid asset path.

when i have a png like this:

http://www.myhhost.de/assets/59f0e7531f25d4c0/some/subfolder/gfx/logo.png

crawlers often try to crawl the "folders" of this path:

http://www.myhhost.de/assets/59f0e7531f25d4c0/some/subfolder/gfx/
or
http://www.myhhost.de/assets/59f0e7531f25d4c0/some/subfolder/

this leads to this NPE as mentioned.

i added a apache2 mod_rewrite rule to not get bothered by this:

RewriteEngine on
RewriteRule ^/assets/\w{16}/.*/$ - [F]

i could detect this easily, because i installed an "requestedUrl" MDC
variable in my log4j environment. so i see in every error-logging-event
what the url was, that caused the error.

see my reply in "Joining tapestry exception handling" thread, how to
accomplish that.

very handy when crawlers and bots cause many error level logging events.

felix


Am 10.05.2012 09:22, schrieb Lance Java:
> I've just taken a look at the 5.2.6 code for ResourceStreamerImpl and it
> looks like the input stream is being closed twice via is.close() and
> InternalUtils.close(is). This looks like a bug to me
> 
>         try
>         {
>             is = streamble.getStream(compress);
> 
>             OutputStream os = response.getOutputStream(contentType);
> 
>             TapestryInternalUtils.copy(is, os);
> 
>             is.close();
>             is = null;
> 
>             os.close();
>         }
>         finally
>         {
>             InternalUtils.close(is);
>         }
> 
> 
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Null-Pointer-Exception-tp5698238p5699340.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Null Pointer Exception

Posted by Lance Java <la...@googlemail.com>.
I've just taken a look at the 5.2.6 code for ResourceStreamerImpl and it
looks like the input stream is being closed twice via is.close() and
InternalUtils.close(is). This looks like a bug to me

        try
        {
            is = streamble.getStream(compress);

            OutputStream os = response.getOutputStream(contentType);

            TapestryInternalUtils.copy(is, os);

            is.close();
            is = null;

            os.close();
        }
        finally
        {
            InternalUtils.close(is);
        }


--
View this message in context: http://tapestry.1045711.n5.nabble.com/Null-Pointer-Exception-tp5698238p5699340.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Null Pointer Exception

Posted by Lance Java <la...@googlemail.com>.
I hastily jumped to the conclusion that it was your code which was calling
close(). It could also be a bug in Tapestry. As I said before, I could be
wrong but this sounds like a strange issue that I have had in the past.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Null-Pointer-Exception-tp5698238p5699330.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Null Pointer Exception

Posted by Simon Raveh <si...@icann.org>.
Thanks,

But I searched my all project and this is not in my code.
Thanks again,

I"ll keep looking.


Simon




On 5/9/12 2:39 PM, "Lance Java" <la...@googlemail.com> wrote:

>I think you might be explicitly calling close() on the response
>outputstream somewhere in your code which you shouldn't do. It's the
>servlet container's responsibility and I think it's failing when tomcat is
>trying to close() a stream that has already been closed.
>
>I could be wrong too ;)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Null Pointer Exception

Posted by Lance Java <la...@googlemail.com>.
I think you might be explicitly calling close() on the response
outputstream somewhere in your code which you shouldn't do. It's the
servlet container's responsibility and I think it's failing when tomcat is
trying to close() a stream that has already been closed.

I could be wrong too ;)