3
votes

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)
1
show lines where yeW are getting errors e.g CoyoteAdapter.java:430 - vicky
@vicky CoyoteAdapter is a standard Tomcat class docjar.com/html/api/org/apache/catalina/connector/… - Taky
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
Show please CommetProcessor implementation code. - Taky
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

1 Answers

1
votes

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.