Hello

Did you try registering separate listeners instead of one with different
interfaces?

I'm not sure about this ValidatorException. Try running mvn with -e option
to show full stack traces.

regards
Grzegorz Grzybek

czw., 14 lut 2019 o 23:45 Nhut Thai Le <[email protected]> napisał(a):

> Hello again,
> For some reason, i was able to get my ServletContextListener working for a
> while then now i need to added another one (for different app context) and
> i found that both the new and old one does not work anymore. My
> other HttpSessionListener is still working fine. Funny is that both the
> ServletContextListener and the HttpSessionListener is extended by the same
> class:
>
> @Component(
> service= {
> javax.servlet.http.HttpSessionListener.class,
> ServletContextListener.class
> },
> property= {
> "osgi.http.whiteboard.listener=true",
> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
> =WebviewerServletContextHelper)",
> "listener.name=WebviewerServletContextListener"
> }
> )
> public final class ZkListener implements
> javax.servlet.http.HttpSessionListener, ServletContextListener {}
>
> Where should i start debugging this?
>
> By the way, I tried to the command to run test on jetty that you suggested
> and i got:
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 19.390 s
> [INFO] Finished at: 2019-02-14T17:32:16-05:00
> [INFO] Final Memory: 24M/274M
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal on project pax-web-itest-container-jetty:
> Could not resolve dependencies for project
> org.ops4j.pax.web.itest.container:pax-web-itest-container-jetty:jar:7.2.9-SNAPSHOT:
> Failed to collect dependencies at
> org.ops4j.pax.web.itest:pax-web-itest-base:jar:7.2.9-SNAPSHOT: Failed to
> read artifact descriptor for
> org.ops4j.pax.web.itest:pax-web-itest-base:jar:7.2.9-SNAPSHOT: Could not
> transfer artifact
> org.ops4j.pax.web.itest:pax-web-itest-base:pom:7.2.9-SNAPSHOT from/to
> prime-repo (http://repository.primefaces.org):
> sun.security.validator.ValidatorException: PKIX path building failed:
> sun.security.provider.certpath.SunCertPathBuilderException: unable to find
> valid certification path to requested target -> [Help 1]
>
> Not sure what is wrong with my cert.
>
> On Tue, Oct 2, 2018 at 4:19 AM Grzegorz Grzybek <[email protected]>
> wrote:
>
>> Hello
>>
>> Sorry for late answer. There's testListenersWithHttpContext() test here:
>> https://github.com/ops4j/org.ops4j.pax.web/blob/pax-web-7.2.x/pax-web-itest/pax-web-itest-common/src/main/java/org/ops4j/pax/web/itest/common/AbstractWhiteboardR6IntegrationTest.java#L289
>>
>> It does exactly what you're trying to achieve, but without SCR - only by
>> registering relevant services. You can run the test from within any of
>> three container itest projects:
>>
>> mvn clean verify -f
>> pax-web-itest/pax-web-itest-container/pax-web-itest-container-jetty/
>> -Dit.test=WhiteboardR6IntegrationTest#testListenersWithHttpContext
>> mvn clean verify -f
>> pax-web-itest/pax-web-itest-container/pax-web-itest-container-tomcat/
>> -Dit.test=WhiteboardR6IntegrationTest#testListenersWithHttpContext
>> mvn clean verify -f
>> pax-web-itest/pax-web-itest-container/pax-web-itest-container-undertow/
>> -Dit.test=WhiteboardR6IntegrationTest#testListenersWithHttpContext
>>
>> I'm not sure what may be your problem (maybe you'll share your maven
>> project via github?) - but this may be related to some other bundles you
>> have installed in your runtime (pure Equinox? pax-exam test? Karaf based on
>> Equinox?) - which may cause problems with finding services you register by
>> pax-web-extender-whiteboard.
>>
>> best regards
>> Grzegorz Grzybek
>>
>> pon., 24 wrz 2018 o 22:13 Nhut Thai Le <[email protected]> napisał(a):
>>
>>> Hello,
>>>
>>> I tried to hook a servletContextListener to my custom
>>> ServletContextHelper but the contextInitialized method is not called.
>>> -------------------Here is my ServletContextHelper:------------
>>> @Component(
>>> service = ServletContextHelper.class,
>>> property = {
>>> "osgi.http.whiteboard.context.name=ZkComponentsServletContextHelper",
>>> "osgi.http.whiteboard.context.path=/components"
>>> }
>>> )
>>> public class ZkComponentsServletContextHelper extends
>>> ServletContextHelper {...}
>>> --------------------------------My ServletContextListener----------
>>> @Component(
>>> name="ZkListener",
>>> service= {
>>> ServletContextListener.class
>>> },
>>> property= {
>>> "osgi.http.whiteboard.listener=true",
>>> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
>>> =ZkComponentsServletContextHelper)"
>>> }
>>> )
>>> public final class ZkSessionListener implements ServletContextListener {
>>> private WebManager webManager;
>>>
>>> @Override
>>> public void contextInitialized(ServletContextEvent sce) {
>>> final ServletContext ctx = sce.getServletContext();
>>> if (WebManager.getWebManagerIfAny(ctx) == null) {
>>> webManager = new WebManager(ctx, "/zkau");
>>> } else {
>>> throw new IllegalStateException("ZK WebManager already exists. Could not
>>> initialize via Spring Boot configuration.");
>>> }
>>> }
>>> ------------------------------Finally, my simple servlet-------------
>>> @Component(
>>> service = Servlet.class,
>>> property= {
>>> "osgi.http.whiteboard.servlet.pattern=*.zul",
>>> "osgi.http.whiteboard.servlet.pattern=*.zhtml",
>>> "osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
>>> =ZkComponentsServletContextHelper)"
>>> }
>>> )
>>> public class ZulExtensionServlet extends HttpServlet{..}
>>> ---------------------equinox bundle info-------------
>>> {org.osgi.service.http.context.ServletContextHelper}={service.id=95,
>>> osgi.http.whiteboard.context.name=ZkComponentsServletContextHelper,
>>> service.bundleid=59, service.scope=bundle, 
>>> component.name=com.castortech.iris.zk.components.ZkComponentsServletContextHelper,
>>> osgi.http.whiteboard.context.path=/components, component.id=3}
>>>
>>> {javax.servlet.Servlet}={service.id=97, service.bundleid=59,
>>> service.scope=bundle, osgi.http.whiteboard.servlet.pattern=[*.zul,*.zhtml],
>>> osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name=ZkComponentsServletContextHelper),
>>> component.name=com.castortech.iris.zk.components.ZulExtensionServlet,
>>> component.id=5}
>>>
>>> {javax.servlet.ServletContextListener}={service.id=98,
>>> service.bundleid=59, service.scope=bundle,
>>> osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name=ZkComponentsServletContextHelper),
>>> osgi.http.whiteboard.listener=true, component.name=ZkListener,
>>> component.id=6}
>>>
>>> {javax.servlet.ServletContext}={osgi.web.version=1.0.0.qualifier,
>>> osgi.web.contextpath=/components, service.id=124,
>>> osgi.web.symbolicname=com.castortech.iris.zk.components,
>>> service.bundleid=59, service.scope=singleton,
>>> osgi.web.contextname=ZkComponentsServletContextHelper}
>>>
>>>
>>> As you can see, both the ServletContextListener and the servlet are
>>> bound to the same ServletContextHelper and there is a ServletContext
>>> created from the ServletContextHelper, however, the contextInitialized
>>> method was never called. Am I missing anything?
>>>
>>> Thai
>>>
>>> --
>>> --
>>> ------------------
>>> OPS4J - http://www.ops4j.org - [email protected]
>>>
>>> ---
>>> 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 [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> --
>> ------------------
>> OPS4J - http://www.ops4j.org - [email protected]
>>
>> ---
>> 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 [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Castor Technologies Inc
> 460 rue St-Catherine St Ouest, Suite 613
> Montréal, Québec H3B-1A7
> (514) 360-7208 o
> (514) 798-2044 f
> [email protected]
> www.castortech.com
>
> CONFIDENTIALITY NOTICE: The information contained in this e-mail is
> confidential and may be proprietary information intended only for the use
> of the individual or entity to whom it is addressed. If the reader of this
> message is not the intended recipient, you are hereby notified that any
> viewing, dissemination, distribution, disclosure, copy or use of the
> information contained in this e-mail message is strictly prohibited. If you
> have received and/or are viewing this e-mail in error, please immediately
> notify the sender by reply e-mail, and delete it from your system without
> reading, forwarding, copying or saving in any manner. Thank you.
> AVIS DE CONFIDENTIALITE: L’information contenue dans ce message est
> confidentiel, peut être protégé par le secret professionnel et est réservé
> à l'usage exclusif du destinataire. Toute autre personne est par les
> présentes avisée qu'il lui est strictement interdit de diffuser, distribuer
> ou reproduire ce message. Si vous avez reçu cette communication par erreur,
> veuillez la détruire immédiatement et en aviser l'expéditeur. Merci.
>
> --
> --
> ------------------
> OPS4J - http://www.ops4j.org - [email protected]
>
> ---
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to