3

I have a servlet implementing CometProcessor and I am trying to get the requests coming to this servlet to pass through a filter. Specifying the servlet in web.xml under does not make the requests to the servlet to pass through the filter. I also tried implementing CometFilter and specified the servlet implementing CometProcessor in web.xml under . I get the following error -

Jan 29, 2013 12:10:04 PM org.apache.catalina.connector.CoyoteAdapter service - SEVERE: An exception or error occurred in the container during the request processing
java.lang.NullPointerException
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:430)
    at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:396)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:356)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1534)
    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)
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user2020498
  • 135
  • 1
  • 8
  • show lines where yeW are getting errors e.g CoyoteAdapter.java:430 – vicky Jan 29 '13 at 07:33
  • @vicky CoyoteAdapter is a standard Tomcat class http://www.docjar.com/html/api/org/apache/catalina/connector/CoyoteAdapter.java.html – Taky Jan 29 '13 at 07:40
  • The easiest way is to attach sources into you IDE and debug request. Seems problem in some logic related with Commet in the service() method. – Taky Jan 29 '13 at 07:46
  • 1
    Show please CommetProcessor implementation code. – Taky Jan 29 '13 at 07:47
  • The CometProcessor code is exactly on the same lines as the chat example in tomcat.apache.org/tomcat-6.0-doc/aio.html When I debug, this is the point where the exception happens in CoyoteAdapter class - ((Context) request.getMappingData().context).logAccess( request, response, System.currentTimeMillis() - req.getStartTime(), false); request.getMappingData().context is null. – user2020498 Jan 29 '13 at 10:15

1 Answers1

1

Thanks for your inputs, I found out where I am going wrong. I had made a mistake in implementing CometFilter. I read the documentation present in the CometFilter class itself and found that I need to implement doFilterEvent method and not doFilter method. Now its working fine and requests to the servlet implementing CometProcessor are being passed to this filter.

user2020498
  • 135
  • 1
  • 8