Servlet Filters registered, activated but not processing request

12 views
Skip to first unread message

Nhut Thai Le

unread,
Aug 15, 2019, 11:30:23 AM8/15/19
to OPS4J
Hello,

I have 4 servlet filters for one ServletContextHelper, having the same filter pattern and they are from the same bundle and have different ranking. When starting server, i see these filters have been registered:

{javax.servlet.Filter}={service.id=992, service.bundleid=405, service.scope=prototype, service.ranking=11, osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name=WebviewerServletContextHelper), filter.init.excludedUrls=/zkcomet,/logout/select,/logout, osgi.http.whiteboard.filter.pattern=/*, component.name=com.castortech.iris.ba.web.filters.BaSessionFilter, osgi.http.whiteboard.filter.asyncSupported=true, component.id=1186}
  "Registered by bundle:" com.castortech.iris.ba.web.filters_1.0.0.qualifier [405]
  "Bundles using service"
    org.ops4j.pax.web.pax-web-extender-whiteboard_7.2.4 [8]
{javax.servlet.Filter}={service.id=1352, service.bundleid=405, service.scope=prototype, service.ranking=3, osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name=WebviewerServletContextHelper), filter.init.excludedUrls=/zkcomet, osgi.http.whiteboard.filter.pattern=/*, component.name=com.castortech.iris.ba.web.filters.TenantFilter, osgi.http.whiteboard.filter.asyncSupported=true, component.id=1185}
  "Registered by bundle:" com.castortech.iris.ba.web.filters_1.0.0.qualifier [405]
  "Bundles using service"
    org.ops4j.pax.web.pax-web-extender-whiteboard_7.2.4 [8]
{javax.servlet.Filter}={service.id=652, service.bundleid=405, service.scope=prototype, service.ranking=2, osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name=WebviewerServletContextHelper), filter.init.excludedUrls=/zkcomet, osgi.http.whiteboard.filter.pattern=/*, component.name=com.castortech.iris.ba.web.filters.KeycloakSessionFilter, osgi.http.whiteboard.filter.asyncSupported=true, component.id=1161}
  "Registered by bundle:" com.castortech.iris.ba.web.filters_1.0.0.qualifier [405]
  "Bundles using service"
    org.ops4j.pax.web.pax-web-extender-whiteboard_7.2.4 [8]
{javax.servlet.Filter}={service.id=653, service.bundleid=405, service.scope=prototype, service.ranking=1, osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name=WebviewerServletContextHelper), component.name=com.castortech.iris.ba.web.filters.AuthenticationFilterForWebViewer, component.id=1164, keycloak.config.resolver=com.castortech.iris.ba.web.filters.BundleBasedKeycloakConfigResolver, filter.init.excludedUrls=/zkcomet, osgi.http.whiteboard.filter.pattern=/*, osgi.http.whiteboard.filter.asyncSupported=true}
  "Registered by bundle:" com.castortech.iris.ba.web.filters_1.0.0.qualifier [405]
  "Bundles using service"
    org.ops4j.pax.web.pax-web-extender-whiteboard_7.2.4 [8]

Normally the request is processed by all 4 filters in ascending order, but this morning, after i restart the server I see when a request come in, it arrives at the TenantFilte (ranking=3) skipping filters ranking 1 and 2. 

filterErr1.PNG

Anyone has an idea why would this happen?




Grzegorz Grzybek

unread,
Sep 10, 2019, 5:04:19 AM9/10/19
to op...@googlegroups.com
Hello

org.ops4j.pax.web.service.internal.HttpServiceStarted#registerFilter() method should correctly take service ranking into account.

With Jetty, filters are registered (sorted by rank) inside org.ops4j.pax.web.service.jetty.internal.JettyServerImpl#addFilter(), you could enable "org.ops4j.pax.web.service.jetty.internal" DEBUG level to check what has happened.

Heap dump would be interesting too to check if all filters were registered.

Do you have Karaf output (if using Karaf at all) for list of services with objectClass=javax.servlet.Filter?

regards
Grzegorz Grzybek

--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/9b41870e-fcfa-4f3c-8d43-eaf94929d375%40googlegroups.com.
Message has been deleted

Jean-Baptiste Onofré

unread,
Sep 14, 2019, 1:59:15 PM9/14/19
to OPS4J
Hi

As said, I did a fix on pax web 7.2.10 about twice service registration. It might help.

Regards
JB

Le sam. 14 sept. 2019 à 19:41, Nhut Thai Le <nt...@castortech.com> a écrit :
We recently upgrade to pax-web 7.2.10 and i haven't seen this happen again yet. Even with 7.2.4 it only happened a few times, I'll post the heap dump and instance of Filter. However, in my question, i showed that all of my 4 filters have been registered and they have componentId, doesnt it mean they are instantiated?

Thai
To unsubscribe from this group and stop receiving emails from it, send an email to op...@googlegroups.com.

--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages