Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pax Web WAR extender, JSF and Aries CDI integration #1622

Closed
grgrzybek opened this issue Jul 7, 2021 · 12 comments
Closed

Pax Web WAR extender, JSF and Aries CDI integration #1622

grgrzybek opened this issue Jul 7, 2021 · 12 comments
Assignees
Milestone

Comments

@grgrzybek
Copy link
Member

This is an issue to collect notes about CDI/JSF integration.

@grgrzybek
Copy link
Member Author

grgrzybek commented Jul 7, 2021

For now I have a WAB with:

<Require-Capability>
	osgi.cdi.extension;filter:="(osgi.cdi.extension=aries.cdi.http)",
	osgi.cdi.extension;filter:="(osgi.cdi.extension=aries.cdi.el.jsp)"
</Require-Capability>
<_cdiannotations>*;discover=annotated</_cdiannotations>

I use Aries CDI 1.1.3 with locally fixed https://issues.apache.org/jira/browse/ARIES-2053

Pax Web 8 (snapshot) provides some compatibility fragments that add OSGi contract to jakarta bundles.

Another bundle fragment from Pax Web 8 tweaks myfaces-core-impl with:

<Fragment-Host>org.apache.myfaces.core.impl</Fragment-Host>
<Require-Capability><![CDATA[
    osgi.extender;filter:="(&(osgi.extender=osgi.serviceloader.registrar)(version>=1.0)(!(version>=2.0)))"
]]></Require-Capability>
<Provide-Capability>
	osgi.serviceloader;osgi.serviceloader=javax.enterprise.inject.spi.Extension;aries.cdi.extension.mode=implicit
</Provide-Capability>

so aries-cdi can load extensions from it and provide them (in implicit mode) to my sample WAB.

Almost everything works.

But there's:

  1. a race condition between aries-cdi extender and pax-web war extender - no synchronization between the CDI container created by aries-cdi and two extensions that register (web whiteboard) two important ServletContextListeners:
  • org.apache.aries.cdi.extension.servlet.weld.WeldServletExtension that registers org.jboss.weld.module.web.servlet.WeldInitialListener
  • org.apache.aries.cdi.extension.el.jsp.ELJSPExtension that registers anonymous ServletContextListener that registers CDI EL resolver and org.jboss.weld.module.web.el.WeldELContextListener
  1. something wrong with MyFaces - or rather I'm not sure how it uses the Weld EL infra when resolving beans (if I manage to register the CDI listeners correctly). I end up with javax.el.PropertyNotFoundException at:
"qtp1926072246-35@4695" prio=5 tid=0x23 nid=NA runnable
  java.lang.Thread.State: RUNNABLE
	  at org.apache.el.parser.AstValue.getTarget(AstValue.java:74)
	  at org.apache.el.parser.AstValue.getType(AstValue.java:58)
	  at org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:174)
	  at org.apache.myfaces.view.facelets.el.ContextAwareTagValueExpression.getType(ContextAwareTagValueExpression.java:76)
	  at org.apache.myfaces.shared.renderkit._SharedRendererUtils.findUIOutputConverter(_SharedRendererUtils.java:78)
	  at org.apache.myfaces.shared.renderkit.RendererUtils.findUIOutputConverter(RendererUtils.java:543)
	  at org.apache.myfaces.shared.renderkit.RendererUtils.getConvertedUIOutputValue(RendererUtils.java:1003)
	  at org.apache.myfaces.shared.renderkit.html.HtmlTextRendererBase.getConvertedValue(HtmlTextRendererBase.java:378)
	  at javax.faces.component.UIInput.getConvertedValue(UIInput.java:789)
	  at javax.faces.component.UIInput.validate(UIInput.java:708)
	  at javax.faces.component.UIInput.processValidators(UIInput.java:293)
	  at javax.faces.component.UIForm.processValidators(UIForm.java:210)
	  at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1458)
	  at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1458)
	  at javax.faces.component.UIViewRoot._processValidatorsDefault(UIViewRoot.java:1782)
	  at javax.faces.component.UIViewRoot.access$600(UIViewRoot.java:81)
	  at javax.faces.component.UIViewRoot$ProcessValidatorPhaseProcessor.process(UIViewRoot.java:1889)
	  at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1738)
	  at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:982)
	  at org.apache.myfaces.lifecycle.ProcessValidationsExecutor.execute(ProcessValidationsExecutor.java:38)
	  at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:195)
	  at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:142)
	  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:204)
	  at org.ops4j.pax.web.service.spi.servlet.OsgiInitializedServlet.service(OsgiInitializedServlet.java:74)
	  at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1459)
	  at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
	  at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626)
	  at org.ops4j.pax.web.samples.warjsf23cdi.EncodingFilter.doFilter(EncodingFilter.java:38)
	  at org.ops4j.pax.web.service.spi.servlet.OsgiInitializedFilter.doFilter(OsgiInitializedFilter.java:69)
	  at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201)
	  at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	  at org.ops4j.pax.web.service.spi.servlet.OsgiFilterChain.doFilter(OsgiFilterChain.java:98)
	  at org.ops4j.pax.web.service.jetty.internal.PaxWebServletHandler.doHandle(PaxWebServletHandler.java:256)
	  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	  at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602)
	  at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	  at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
	  at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
	  at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
	  at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435)
	  at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
	  at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
	  at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
	  at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
	  at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350)
	  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	  at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234)
	  at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	  at org.eclipse.jetty.server.Server.handle(Server.java:516)
	  at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
	  at org.eclipse.jetty.server.HttpChannel$$Lambda$484.1826467167.dispatch(Unknown Source:-1)
	  at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
	  at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
	  at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
	  at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	  at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
	  at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	  at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
	  at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
	  at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
	  at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:137)
	  at org.eclipse.jetty.io.ManagedSelector$$Lambda$96.916934355.run(Unknown Source:-1)
	  at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882)
	  at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036)
	  at java.lang.Thread.run(Thread.java:748)

The other thing is that for now, pax-web-extender-war doesn't take into account whiteboard-registered elements that are supposed to alter the context created for the WAB. I'm working on it.

Yet another thing is (cc: @rotty3000) that if I wanted to synchronize with aries-cdi, I could register a org.apache.aries.cdi.container.internal.spi.ContainerListener service to get notified about container bootstrap. but this interface is in a private package of org.apache.aries.cdi.extender...

@grgrzybek
Copy link
Member Author

With current implementation of Pax Web 8, where server configuration (consuming configuration changes from many trackers and invocations) is performed in single "pax web config thread", there's a deadlock between Aries CCR thread that first grabbed a CDI container lock and later whiteboard-registers the listener:

"Aries CCR Thread (1238994373)@5254" prio=5 tid=0x2a nid=NA waiting
  java.lang.Thread.State: WAITING
	 blocks paxweb-config-1-thread-1@3788
	  at sun.misc.Unsafe.park(Unsafe.java:-1)
	  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
	  at java.util.concurrent.CompletableFuture$Signaller.block(CompletableFuture.java:1707)
	  at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3323)
	  at java.util.concurrent.CompletableFuture.waitingGet(CompletableFuture.java:1742)
	  at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
	  at org.ops4j.pax.web.service.spi.model.ServerModel.run(ServerModel.java:447)
	  at org.ops4j.pax.web.service.internal.HttpServiceEnabled.doRegisterEventListener(HttpServiceEnabled.java:934)
	  at org.ops4j.pax.web.service.internal.HttpServiceEnabled.access$1300(HttpServiceEnabled.java:95)
	  at org.ops4j.pax.web.service.internal.HttpServiceEnabled$WhiteboardWebContainer.registerListener(HttpServiceEnabled.java:1744)
	  at org.ops4j.pax.web.service.spi.model.elements.EventListenerModel.register(EventListenerModel.java:38)
	  at org.ops4j.pax.web.extender.whiteboard.internal.BundleWhiteboardApplication.addWebElement(BundleWhiteboardApplication.java:238)
	  at org.ops4j.pax.web.extender.whiteboard.internal.WhiteboardExtenderContext.addWebElement(WhiteboardExtenderContext.java:448)
	  at org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractElementTracker.addingService(AbstractElementTracker.java:248)
	  at org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractElementTracker.addingService(AbstractElementTracker.java:62)
	  at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943)
	  at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:871)
	  at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
	  at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
	  at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:903)
	  at org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:990)
	  at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838)
	  at org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545)
	  at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4833)
	  at org.apache.felix.framework.Felix.registerService(Felix.java:3804)
	  at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:328)
	  at org.apache.aries.cdi.extension.servlet.weld.WeldServletExtension.afterDeploymentValidation(WeldServletExtension.java:78)
	  at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
	  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	  at java.lang.reflect.Method.invoke(Method.java:498)
	  at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95)
	  at org.jboss.weld.injection.MethodInvocationStrategy$SpecialParamPlusBeanManagerStrategy.invoke(MethodInvocationStrategy.java:187)
	  at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:330)
	  at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:123)
	  - locked <0x1ec4> (a org.jboss.weld.Container)
	  at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:308)
	  at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:286)
	  at javax.enterprise.inject.spi.ObserverMethod.notify(ObserverMethod.java:124)
	  at org.jboss.weld.util.Observers.notify(Observers.java:166)
	  at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:285)
	  at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:273)
	  at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:177)
	  at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:171)
	  at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53)
	  at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:35)
	  at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28)
	  at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:505)
	  at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:93)
	  - locked <0x1ec5> (a org.jboss.weld.bootstrap.WeldBootstrap)
	  at org.apache.aries.cdi.weld.WeldCDIContainerInitializer.initialize(WeldCDIContainerInitializer.java:122)
	  at org.apache.aries.cdi.container.internal.container.ContainerBootstrap.open(ContainerBootstrap.java:153)
	  at org.apache.aries.cdi.container.internal.model.ContainerActivator$$Lambda$222.706596814.call(Unknown Source:-1)
	  at org.osgi.util.promise.DeferredPromiseImpl$Submit.run(DeferredPromiseImpl.java:658)
	  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	  at java.lang.Thread.run(Thread.java:748)

and pax-web-config thread that passes the listener to jetty instance and calling contextInitialized():

"paxweb-config-1-thread-1@3788" prio=5 tid=0x1c nid=NA waiting for monitor entry
  java.lang.Thread.State: BLOCKED
	 waiting for Aries CCR Thread (1238994373)@5254 to release lock on <0x1ec4> (a org.jboss.weld.Container)
	  at org.jboss.weld.module.web.servlet.HttpContextLifecycle.fireEventForApplicationScope(HttpContextLifecycle.java:160)
	  at org.jboss.weld.module.web.servlet.HttpContextLifecycle.contextInitialized(HttpContextLifecycle.java:147)
	  at org.jboss.weld.module.web.servlet.WeldInitialListener.contextInitialized(WeldInitialListener.java:99)
	  at org.apache.aries.cdi.extension.servlet.weld.WeldServletExtension$ListenerWrapper.contextInitialized(WeldServletExtension.java:112)
	  at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.lambda$visit$12(JettyServerWrapper.java:1312)
	  at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper$$Lambda$396.1594683460.accept(Unknown Source:-1)
	  at java.util.ArrayList.forEach(ArrayList.java:1259)
	  at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1082)
	  at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.visit(JettyServerWrapper.java:1294)
	  at org.ops4j.pax.web.service.spi.task.EventListenerModelChange.accept(EventListenerModelChange.java:76)
	  at org.ops4j.pax.web.service.spi.task.Batch.accept(Batch.java:381)
	  at org.ops4j.pax.web.service.jetty.internal.JettyServerController.sendBatch(JettyServerController.java:168)
	  at org.ops4j.pax.web.service.internal.HttpServiceEnabled.lambda$doRegisterEventListener$5(HttpServiceEnabled.java:941)
	  at org.ops4j.pax.web.service.internal.HttpServiceEnabled$$Lambda$401.688175439.run(Unknown Source:-1)
	  at org.ops4j.pax.web.service.spi.model.ServerModel.lambda$run$2(ServerModel.java:441)
	  at org.ops4j.pax.web.service.spi.model.ServerModel$$Lambda$102.1267929678.get(Unknown Source:-1)
	  at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
	  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	  at java.lang.Thread.run(Thread.java:748)

I could successfully start the Jetty container (or just the listener) in separate threads, but many existing tests I had started to behave randomly.

@grgrzybek
Copy link
Member Author

grgrzybek commented Jul 7, 2021

https://stackoverflow.com/a/47447140/250517 mentions the need to use @javax.faces.annotation.FacesConfig annotation on any CDI bean, because only this way we can make org.apache.myfaces.el.unified.ResolverBuilderBase#isReplaceImplicitObjectResolverWithCDIResolver() return true here:

"qtp295071313-62@7689" prio=5 tid=0x3e nid=NA runnable
  java.lang.Thread.State: RUNNABLE
	  at org.apache.myfaces.el.unified.ResolverBuilderBase.isReplaceImplicitObjectResolverWithCDIResolver(ResolverBuilderBase.java:238)
	  at org.apache.myfaces.el.unified.ResolverBuilderForFaces.build(ResolverBuilderForFaces.java:108)
	  at org.apache.myfaces.application.ApplicationImpl.createFacesResolver(ApplicationImpl.java:408)
	  at org.apache.myfaces.application.ApplicationImpl.getELResolver(ApplicationImpl.java:389)
	  at org.apache.myfaces.context.servlet.FacesContextImplBase.getELContext(FacesContextImplBase.java:230)
	  at org.apache.myfaces.view.facelets.impl.DefaultFaceletContext.<init>(DefaultFaceletContext.java:158)
	  at org.apache.myfaces.view.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:164)
	  at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage$FaceletViewMetadata.createMetadataView(FaceletViewDeclarationLanguage.java:2776)
	  at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:252)
	  at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:195)
	  at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:142)
	  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:204)
	  at org.ops4j.pax.web.service.spi.servlet.OsgiInitializedServlet.service(OsgiInitializedServlet.java:74)
	  at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1459)
	  at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
	  at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626)
	  at org.ops4j.pax.web.samples.warjsf23cdi.EncodingFilter.doFilter(EncodingFilter.java:38)
	  at org.ops4j.pax.web.service.spi.servlet.OsgiInitializedFilter.doFilter(OsgiInitializedFilter.java:69)
	  at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201)
	  at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	  at org.ops4j.pax.web.service.spi.servlet.OsgiFilterChain.doFilter(OsgiFilterChain.java:98)
	  at org.ops4j.pax.web.service.jetty.internal.PaxWebServletHandler.doHandle(PaxWebServletHandler.java:256)
	  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	  at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602)
	  at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	  at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
	  at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
	  at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
	  at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435)
	  at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
	  at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
	  at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
	  at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
	  at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350)
	  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	  at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234)
	  at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	  at org.eclipse.jetty.server.Server.handle(Server.java:516)
	  at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
	  at org.eclipse.jetty.server.HttpChannel$$Lambda$442.122098582.dispatch(Unknown Source:-1)
	  at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
	  at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
	  at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
	  at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	  at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
	  at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	  at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882)
	  at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036)
	  at java.lang.Thread.run(Thread.java:748)

@grgrzybek
Copy link
Member Author

Now, I have:

Caused by: org.jboss.weld.contexts.ContextNotActiveException: WELD-001303: No active contexts for scope type org.osgi.service.cdi.annotations.ComponentScoped
	at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:647) ~[?:?]
	at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:94) ~[?:?]
	at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50) ~[?:?]
	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:694) ~[?:?]
	at org.jboss.weld.module.web.el.AbstractWeldELResolver.lookup(AbstractWeldELResolver.java:107) ~[?:?]
	at org.jboss.weld.module.web.el.AbstractWeldELResolver.getValue(AbstractWeldELResolver.java:90) ~[?:?]
	at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:136) ~[?:?]
	at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:179) ~[?:?]
	at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:94) ~[?:?]
	at org.apache.el.parser.AstValue.getValue(AstValue.java:137) ~[?:?]
	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:190) ~[?:?]
	at org.apache.myfaces.view.facelets.el.ContextAwareTagValueExpression.getValue(ContextAwareTagValueExpression.java:93) ~[?:?]
	at javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:356) ~[?:?]
	at javax.faces.component.UIOutput.getValue(UIOutput.java:67) ~[?:?]
	at javax.faces.component.UIInput.getValue(UIInput.java:170) ~[?:?]
	at org.apache.myfaces.shared.renderkit.RendererUtils.getValue(RendererUtils.java:486) ~[?:?]
	at org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(RendererUtils.java:324) ~[?:?]
	at org.apache.myfaces.shared.renderkit.html.HtmlTextRendererBase.renderValue(HtmlTextRendererBase.java:278) ~[?:?]
	at org.apache.myfaces.shared.renderkit.html.HtmlTextRendererBase.renderInputBegin(HtmlTextRendererBase.java:200) ~[?:?]
	at org.apache.myfaces.shared.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:180) ~[?:?]
	at org.apache.myfaces.shared.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:69) ~[?:?]
	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:675) ~[?:?]
	at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:555) ~[?:?]
	at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:551) ~[?:?]
	at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:551) ~[?:?]
	at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:551) ~[?:?]
	at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1897) ~[?:?]
	at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:315) ~[?:?]
	at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:122) ~[?:?]
	at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:266) ~[?:?]
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:206) ~[?:?]
	... 62 more

even if I see nice set of contexts:

contexts = {java.util.concurrent.ConcurrentHashMap@8137}  size = 11
 {@5122} "interface org.osgi.service.cdi.annotations.ComponentScoped" -> {java.util.concurrent.CopyOnWriteArrayList@8650}  size = 1
 {@6142} "interface javax.inject.Singleton" -> {java.util.concurrent.CopyOnWriteArrayList@8709}  size = 1
 {@6073} "interface javax.enterprise.context.ApplicationScoped" -> {java.util.concurrent.CopyOnWriteArrayList@8713}  size = 1
 {@6145} "interface javax.enterprise.context.SessionScoped" -> {java.util.concurrent.CopyOnWriteArrayList@8710}  size = 3
 {@6150} "interface javax.enterprise.context.ConversationScoped" -> {java.util.concurrent.CopyOnWriteArrayList@8714}  size = 2
 {@6151} "interface javax.enterprise.context.RequestScoped" -> {java.util.concurrent.CopyOnWriteArrayList@8715}  size = 4
 {@6152} "interface javax.enterprise.context.Dependent" -> {java.util.concurrent.CopyOnWriteArrayList@8717}  size = 1
 {@6369} "interface javax.faces.view.ViewScoped" -> {java.util.concurrent.CopyOnWriteArrayList@8712}  size = 1
 {@6634} "interface javax.faces.flow.FlowScoped" -> {java.util.concurrent.CopyOnWriteArrayList@8716}  size = 1
 {@6618} "interface org.apache.myfaces.cdi.scope.FacesScoped" -> {java.util.concurrent.CopyOnWriteArrayList@8711}  size = 1
 {@6620} "interface org.apache.myfaces.cdi.scope.ViewTransientScoped" -> {java.util.concurrent.CopyOnWriteArrayList@8708}  size = 1

the org.apache.aries.cdi.container.internal.container.ComponentContext is not active...

@grgrzybek
Copy link
Member Author

grgrzybek commented Jul 7, 2021

And it works! I probably didn't understand @ComponentScoped - I switched to @RequestScoped...

"qtp1564809266-35@4647" prio=5 tid=0x23 nid=NA runnable
  java.lang.Thread.State: RUNNABLE
	  at org.ops4j.pax.web.samples.warjsf23cdi.Hello.say(Hello.java:64)
	  at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
	  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	  at java.lang.reflect.Method.invoke(Method.java:498)
	  at org.apache.el.parser.AstValue.invoke(AstValue.java:247)
	  at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:267)
	  at org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpression.invoke(ContextAwareTagMethodExpression.java:96)
	  at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
	  at javax.faces.component.UICommand.broadcast(UICommand.java:120)
	  at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:1255)
	  at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:420)
	  at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1741)
	  at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:935)
	  at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:42)
	  at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:195)
	  at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:142)
	  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:204)
	  at org.ops4j.pax.web.service.spi.servlet.OsgiInitializedServlet.service(OsgiInitializedServlet.java:74)
	  at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1459)
	  at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
	  at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626)
	  at org.ops4j.pax.web.samples.warjsf23cdi.EncodingFilter.doFilter(EncodingFilter.java:38)
	  at org.ops4j.pax.web.service.spi.servlet.OsgiInitializedFilter.doFilter(OsgiInitializedFilter.java:69)
	  at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201)
	  at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	  at org.ops4j.pax.web.service.spi.servlet.OsgiFilterChain.doFilter(OsgiFilterChain.java:98)
	  at org.ops4j.pax.web.service.jetty.internal.PaxWebServletHandler.doHandle(PaxWebServletHandler.java:256)
	  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	  at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602)
	  at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	  at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
	  at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
	  at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
	  at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435)
	  at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
	  at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
	  at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
	  at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
	  at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350)
	  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	  at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234)
	  at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	  at org.eclipse.jetty.server.Server.handle(Server.java:516)
	  at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
	  at org.eclipse.jetty.server.HttpChannel$$Lambda$473.1078867727.dispatch(Unknown Source:-1)
	  at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
	  at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
	  at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
	  at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	  at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
	  at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	  at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
	  at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
	  at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
	  at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:137)
	  at org.eclipse.jetty.io.ManagedSelector$$Lambda$95.911253414.run(Unknown Source:-1)
	  at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882)
	  at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036)
	  at java.lang.Thread.run(Thread.java:748)

@grgrzybek
Copy link
Member Author

grgrzybek commented Jul 7, 2021

Well, almost works. I tried @RequestScoped, @SessionScoped, but new instance of my hello CDI bean is created not only on each request (with @SessionScoped), but on each EL expression access...

@grgrzybek
Copy link
Member Author

Finally. @RequestScoped actually worked, but previously it was loaded from AppClassLoader for the bean and from cdi-api bundle for Weld itself. So it ended with @Dependent scope.

Now, the only thing is that I have to think about clever way of:

  • synchronizing multiple extenders (pax-web-extender-war and aries-cdi-extender)
  • two order scenarios - 1) when WAB is registered first and listeners from aries-cdi extensions later (whiteboard) and 2) when listeners from aries-cdi extensions are registered first (when there's still no OsgiServletContext for given context path and WAB is registered (deployed) later

grgrzybek added a commit that referenced this issue Jul 8, 2021
…DI, MyFaces and Weld. Works only under debugger.
grgrzybek added a commit that referenced this issue Jul 8, 2021
…DI, MyFaces and Weld. Works only under debugger.
@grgrzybek grgrzybek added this to the 8.0.1 milestone Dec 7, 2021
@grgrzybek grgrzybek modified the milestones: 8.0.1, 8.0.2 Feb 7, 2022
@grgrzybek
Copy link
Member Author

After proper handling of listeners (calling contextInitialized() according to service ranking), it looks better. Now I have one deadlock:

Java stack information for the threads listed above:
===================================================
"HttpService->Whiteboard (stop PAXEXAM-PROBE-e95daa72-6fbc-4c5f-8575-2061a8890370)":
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000005cffeaa80> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:870)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1199)
	at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:209)
	at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)
	at org.ops4j.pax.web.extender.whiteboard.internal.WhiteboardExtenderContext.bundleStopped(WhiteboardExtenderContext.java:172)
	at org.ops4j.pax.web.service.spi.util.WebContainerManager.lambda$bundleChanged$3(WebContainerManager.java:313)
	at org.ops4j.pax.web.service.spi.util.WebContainerManager$$Lambda$519/2031802702.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)
"paxweb-config-1-thread-1":
	at org.jboss.weld.module.web.servlet.HttpContextLifecycle.fireEventForApplicationScope(HttpContextLifecycle.java:160)
	- waiting to lock <0x00000007203ea970> (a org.jboss.weld.Container)
	at org.jboss.weld.module.web.servlet.HttpContextLifecycle.contextInitialized(HttpContextLifecycle.java:147)
	at org.jboss.weld.module.web.servlet.WeldInitialListener.contextInitialized(WeldInitialListener.java:99)
	at org.apache.aries.cdi.extension.servlet.weld.WeldServletExtension$ListenerWrapper.contextInitialized(WeldServletExtension.java:112)
	at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:1073)
	at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:572)
	at org.ops4j.pax.web.service.jetty.internal.PaxWebServletContextHandler.callContextInitialized(PaxWebServletContextHandler.java:128)
	at org.eclipse.jetty.server.handler.ContextHandler.contextInitialized(ContextHandler.java:1002)
	at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:746)
	at org.ops4j.pax.web.service.jetty.internal.PaxWebServletHandler.initialize(PaxWebServletHandler.java:153)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:379)
	at org.ops4j.pax.web.service.jetty.internal.PaxWebServletContextHandler.startContext(PaxWebServletContextHandler.java:233)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:916)
	at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288)
	at org.ops4j.pax.web.service.jetty.internal.PaxWebServletContextHandler.doStart(PaxWebServletContextHandler.java:261)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
	- locked <0x0000000727a38d20> (a java.lang.Object)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.ensureServletContextStarted(JettyServerWrapper.java:2214)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.lambda$visitEventListenerModelChange$15(JettyServerWrapper.java:1578)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper$$Lambda$457/670308421.accept(Unknown Source)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1082)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.visitEventListenerModelChange(JettyServerWrapper.java:1540)
	at org.ops4j.pax.web.service.spi.task.EventListenerModelChange.accept(EventListenerModelChange.java:79)
	at org.ops4j.pax.web.service.spi.task.Batch.accept(Batch.java:430)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerController.sendBatch(JettyServerController.java:168)
	at org.ops4j.pax.web.service.internal.HttpServiceEnabled.lambda$doRegisterEventListener$5(HttpServiceEnabled.java:1014)
	at org.ops4j.pax.web.service.internal.HttpServiceEnabled$$Lambda$463/1485312724.run(Unknown Source)
	at org.ops4j.pax.web.service.spi.model.ServerModel.run(ServerModel.java:520)
	at org.ops4j.pax.web.service.internal.HttpServiceEnabled.doRegisterEventListener(HttpServiceEnabled.java:1007)
	at org.ops4j.pax.web.service.internal.HttpServiceEnabled.access$1400(HttpServiceEnabled.java:112)
	at org.ops4j.pax.web.service.internal.HttpServiceEnabled$WhiteboardWebContainer.registerListener(HttpServiceEnabled.java:2137)
	at org.ops4j.pax.web.service.spi.model.elements.EventListenerModel.register(EventListenerModel.java:62)
	at org.ops4j.pax.web.extender.whiteboard.internal.WhiteboardExtenderContext.reRegisterWebElements(WhiteboardExtenderContext.java:465)
	at org.ops4j.pax.web.extender.whiteboard.internal.WhiteboardExtenderContext.wabContextRegistered(WhiteboardExtenderContext.java:191)
	at org.ops4j.pax.web.service.spi.model.ServerModel.lambda$associateHttpContext$5(ServerModel.java:998)
	at org.ops4j.pax.web.service.spi.model.ServerModel$$Lambda$488/759922831.run(Unknown Source)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)
"FelixStartLevel":
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000005cffeaa80> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:870)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1199)
	at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:209)
	at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)
	at org.ops4j.pax.web.extender.whiteboard.internal.WhiteboardExtenderContext.removeWebElement(WhiteboardExtenderContext.java:506)
	at org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractElementTracker.removedService(AbstractElementTracker.java:310)
	at org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractElementTracker.removedService(AbstractElementTracker.java:62)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:969)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:871)
	at org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:341)
	at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:911)
	at org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:990)
	at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838)
	at org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545)
	at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4833)
	at org.apache.felix.framework.Felix.access$000(Felix.java:112)
	at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:434)
	at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:170)
	at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:145)
	at org.apache.aries.cdi.extension.servlet.common.BaseServletExtension.beforeShutdown(BaseServletExtension.java:216)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95)
	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:85)
	at org.jboss.weld.injection.MethodInvocationStrategy$SimpleMethodInvocationStrategy.invoke(MethodInvocationStrategy.java:168)
	at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:330)
	at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:123)
	- locked <0x00000007203ea970> (a org.jboss.weld.Container)
	at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:308)
	at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:286)
	at javax.enterprise.inject.spi.ObserverMethod.notify(ObserverMethod.java:124)
	at org.jboss.weld.util.Observers.notify(Observers.java:166)
	at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:285)
	at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:273)
	at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:177)
	at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:171)
	at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53)
	at org.jboss.weld.bootstrap.events.BeforeShutdownImpl.fire(BeforeShutdownImpl.java:41)
	at org.jboss.weld.bootstrap.events.BeforeShutdownImpl.fire(BeforeShutdownImpl.java:32)
	at org.jboss.weld.bootstrap.WeldRuntime.shutdown(WeldRuntime.java:69)
	at org.jboss.weld.bootstrap.WeldBootstrap.shutdown(WeldBootstrap.java:116)
	- locked <0x000000071ecd6308> (a org.jboss.weld.bootstrap.WeldBootstrap)
	at org.apache.aries.cdi.weld.WeldCDIContainerInitializer$WeldSeContainer.close(WeldCDIContainerInitializer.java:154)
	at org.apache.aries.cdi.container.internal.container.ContainerBootstrap.close(ContainerBootstrap.java:89)
	at org.apache.aries.cdi.container.internal.model.ContainerActivator$$Lambda$237/907063248.call(Unknown Source)
	at org.apache.aries.cdi.container.internal.container.ContainerState.submit(ContainerState.java:319)
	at org.apache.aries.cdi.container.internal.container.Phase.submit(Phase.java:50)
	at org.apache.aries.cdi.container.internal.model.ContainerActivator.lambda$close$2(ContainerActivator.java:52)
	at org.apache.aries.cdi.container.internal.model.ContainerActivator$$Lambda$236/18193875.apply(Unknown Source)
	at java.util.Optional.map(Optional.java:215)
	at org.apache.aries.cdi.container.internal.model.ContainerActivator.close(ContainerActivator.java:50)
	at org.apache.aries.cdi.container.internal.container.ReferenceSync$$Lambda$235/1160487516.call(Unknown Source)
	at org.apache.aries.cdi.container.internal.container.ContainerState.submit(ContainerState.java:319)
	at org.apache.aries.cdi.container.internal.container.ReferenceSync.updateStatically(ReferenceSync.java:189)
	at org.apache.aries.cdi.container.internal.container.ReferenceSync.removedService(ReferenceSync.java:175)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:969)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:871)
	at org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:341)
	at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:911)
	at org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:990)
	at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838)
	at org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545)
	at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4833)
	at org.apache.felix.framework.Felix.access$000(Felix.java:112)
	at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:434)
	at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:170)
	at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:145)
	at org.ops4j.pax.url.commons.handler.HandlerActivator.stop(HandlerActivator.java:141)
	at org.apache.felix.framework.util.SecureAction.stopActivator(SecureAction.java:720)
	at org.apache.felix.framework.Felix.stopBundle(Felix.java:2795)
	at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1557)
	at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
	at java.lang.Thread.run(Thread.java:750)

@grgrzybek
Copy link
Member Author

It doesn't now look like deadlock between Aries CDI and Pax Web! Simply the WAR with JSF+CDI is redeployed (because of newly registered CDI context listener) and upon first DEPLOYED event, the test fails (HTTP 404) and stops the bundle. And the bundle stop leads to a deadlock with just redeploying application.

@grgrzybek
Copy link
Member Author

grgrzybek commented Feb 19, 2022

And another deadlock:

"Aries CCR Thread (1599823012)" #52 prio=5 os_prio=0 tid=0x00007eff0d7bc800 nid=0x36474 waiting on condition [0x00007efe59adf000]
   java.lang.Thread.State: WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x000000071c9827b8> (a java.util.concurrent.CompletableFuture$Signaller)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
	at java.util.concurrent.CompletableFuture$Signaller.block(CompletableFuture.java:1707)
	at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3323)
	at java.util.concurrent.CompletableFuture.waitingGet(CompletableFuture.java:1742)
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
	at org.ops4j.pax.web.service.spi.model.ServerModel.run(ServerModel.java:535)
	at org.ops4j.pax.web.service.internal.HttpServiceEnabled.doRegisterEventListener(HttpServiceEnabled.java:1007)
	at org.ops4j.pax.web.service.internal.HttpServiceEnabled.access$1400(HttpServiceEnabled.java:112)
	at org.ops4j.pax.web.service.internal.HttpServiceEnabled$WhiteboardWebContainer.registerListener(HttpServiceEnabled.java:2137)
	at org.ops4j.pax.web.service.spi.model.elements.EventListenerModel.register(EventListenerModel.java:62)
	at org.ops4j.pax.web.extender.whiteboard.internal.BundleWhiteboardApplication.addWebElement(BundleWhiteboardApplication.java:232)
	at org.ops4j.pax.web.extender.whiteboard.internal.WhiteboardExtenderContext.addWebElement(WhiteboardExtenderContext.java:499)
	at org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractElementTracker.addingService(AbstractElementTracker.java:264)
	at org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractElementTracker.addingService(AbstractElementTracker.java:184)
	at org.ops4j.pax.web.extender.whiteboard.internal.tracker.AbstractElementTracker.addingService(AbstractElementTracker.java:62)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:871)
	at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
	at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
	at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:903)
	at org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:990)
	at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838)
	at org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545)
	at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4833)
	at org.apache.felix.framework.Felix.registerService(Felix.java:3804)
	at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:328)
	at org.apache.aries.cdi.extension.servlet.weld.WeldServletExtension.afterDeploymentValidation(WeldServletExtension.java:78)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95)
	at org.jboss.weld.injection.MethodInvocationStrategy$SpecialParamPlusBeanManagerStrategy.invoke(MethodInvocationStrategy.java:187)
	at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:330)
	at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:123)
	- locked <0x0000000738240a90> (a org.jboss.weld.Container)
	at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:308)
	at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:286)
	at javax.enterprise.inject.spi.ObserverMethod.notify(ObserverMethod.java:124)
	at org.jboss.weld.util.Observers.notify(Observers.java:166)
	at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:285)
	at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:273)
	at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:177)
	at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:171)
	at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53)
	at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:35)
	at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28)
	at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:505)
	at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:93)
	- locked <0x000000073829d760> (a org.jboss.weld.bootstrap.WeldBootstrap)
	at org.apache.aries.cdi.weld.WeldCDIContainerInitializer.initialize(WeldCDIContainerInitializer.java:122)
	at org.apache.aries.cdi.container.internal.container.ContainerBootstrap.open(ContainerBootstrap.java:153)
	at org.apache.aries.cdi.container.internal.model.ContainerActivator$$Lambda$244/2041276879.call(Unknown Source)
	at org.osgi.util.promise.DeferredPromiseImpl$Submit.run(DeferredPromiseImpl.java:755)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)

   Locked ownable synchronizers:
	- <0x0000000738183f00> (a java.util.concurrent.ThreadPoolExecutor$Worker)
	- <0x00000007383d42e0> (a java.util.concurrent.locks.ReentrantLock$FairSync)
	- <0x00000005cfef48d8> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)

"HttpService->Whiteboard (stop PAXEXAM-PROBE-d06184c9-952e-4e46-a967-5b0fc62ce298)" #46 prio=5 os_prio=0 tid=0x00007efe3029f000 nid=0x3646e waiting on condition [0x00007efe59be5000]
   java.lang.Thread.State: WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000005cfef48d8> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:870)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1199)
	at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:209)
	at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)
	at org.ops4j.pax.web.extender.whiteboard.internal.WhiteboardExtenderContext.bundleStopped(WhiteboardExtenderContext.java:172)
	at org.ops4j.pax.web.service.spi.util.WebContainerManager.lambda$bundleChanged$3(WebContainerManager.java:313)
	at org.ops4j.pax.web.service.spi.util.WebContainerManager$$Lambda$501/792344989.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)

   Locked ownable synchronizers:
	- <0x00000005cfd575e0> (a java.util.concurrent.ThreadPoolExecutor$Worker)

"paxweb-config-1-thread-1" #32 prio=5 os_prio=0 tid=0x00007efe540bf800 nid=0x36461 waiting for monitor entry [0x00007efe5b327000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at org.jboss.weld.module.web.servlet.HttpContextLifecycle.fireEventForApplicationScope(HttpContextLifecycle.java:160)
	- waiting to lock <0x0000000738240a90> (a org.jboss.weld.Container)
	at org.jboss.weld.module.web.servlet.HttpContextLifecycle.contextInitialized(HttpContextLifecycle.java:147)
	at org.jboss.weld.module.web.servlet.WeldInitialListener.contextInitialized(WeldInitialListener.java:99)
	at org.apache.aries.cdi.extension.servlet.weld.WeldServletExtension$ListenerWrapper.contextInitialized(WeldServletExtension.java:112)
	at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:1073)
	at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:572)
	at org.ops4j.pax.web.service.jetty.internal.PaxWebServletContextHandler.callContextInitialized(PaxWebServletContextHandler.java:128)
	at org.eclipse.jetty.server.handler.ContextHandler.contextInitialized(ContextHandler.java:1002)
	at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:746)
	at org.ops4j.pax.web.service.jetty.internal.PaxWebServletHandler.initialize(PaxWebServletHandler.java:153)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:379)
	at org.ops4j.pax.web.service.jetty.internal.PaxWebServletContextHandler.startContext(PaxWebServletContextHandler.java:233)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:916)
	at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288)
	at org.ops4j.pax.web.service.jetty.internal.PaxWebServletContextHandler.doStart(PaxWebServletContextHandler.java:261)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
	- locked <0x0000000738435cf8> (a java.lang.Object)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.ensureServletContextStarted(JettyServerWrapper.java:2214)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.lambda$visitEventListenerModelChange$15(JettyServerWrapper.java:1578)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper$$Lambda$430/908123789.accept(Unknown Source)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1082)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper.visitEventListenerModelChange(JettyServerWrapper.java:1540)
	at org.ops4j.pax.web.service.spi.task.EventListenerModelChange.accept(EventListenerModelChange.java:79)
	at org.ops4j.pax.web.service.spi.task.Batch.accept(Batch.java:430)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerController.sendBatch(JettyServerController.java:168)
	at org.ops4j.pax.web.service.internal.HttpServiceEnabled.lambda$doRegisterEventListener$5(HttpServiceEnabled.java:1014)
	at org.ops4j.pax.web.service.internal.HttpServiceEnabled$$Lambda$443/974423816.run(Unknown Source)
	at org.ops4j.pax.web.service.spi.model.ServerModel.lambda$run$2(ServerModel.java:529)
	at org.ops4j.pax.web.service.spi.model.ServerModel$$Lambda$117/602318138.get(Unknown Source)
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)

   Locked ownable synchronizers:
	- <0x00000005cfe68b30> (a java.util.concurrent.ThreadPoolExecutor$Worker)

"FelixStartLevel" #23 daemon prio=5 os_prio=0 tid=0x00007eff0d224000 nid=0x3644e waiting on condition [0x00007efeb0101000]
   java.lang.Thread.State: WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000007383d42e0> (a java.util.concurrent.locks.ReentrantLock$FairSync)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:870)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1199)
	at java.util.concurrent.locks.ReentrantLock$FairSync.lock(ReentrantLock.java:224)
	at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)
	at org.apache.aries.cdi.container.internal.util.Syncro.open(Syncro.java:32)
	at org.apache.aries.cdi.container.internal.container.ContainerBootstrap.close(ContainerBootstrap.java:85)
	at org.apache.aries.cdi.container.internal.model.ContainerActivator$$Lambda$237/448218872.call(Unknown Source)
	at org.apache.aries.cdi.container.internal.container.ContainerState.submit(ContainerState.java:319)
	at org.apache.aries.cdi.container.internal.container.Phase.submit(Phase.java:50)
	at org.apache.aries.cdi.container.internal.model.ContainerActivator.lambda$close$2(ContainerActivator.java:52)
	at org.apache.aries.cdi.container.internal.model.ContainerActivator$$Lambda$236/1814925887.apply(Unknown Source)
	at java.util.Optional.map(Optional.java:215)
	at org.apache.aries.cdi.container.internal.model.ContainerActivator.close(ContainerActivator.java:50)
	at org.apache.aries.cdi.container.internal.container.ReferenceSync$$Lambda$235/47418178.call(Unknown Source)
	at org.apache.aries.cdi.container.internal.container.ContainerState.submit(ContainerState.java:319)
	at org.apache.aries.cdi.container.internal.container.ReferenceSync.updateStatically(ReferenceSync.java:189)
	at org.apache.aries.cdi.container.internal.container.ReferenceSync.removedService(ReferenceSync.java:175)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:969)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:871)
	at org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:341)
	at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:911)
	at org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:990)
	at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838)
	at org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545)
	at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4833)
	at org.apache.felix.framework.Felix.access$000(Felix.java:112)
	at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:434)
	at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:170)
	at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:145)
	at org.ops4j.pax.url.commons.handler.HandlerActivator.stop(HandlerActivator.java:141)
	at org.apache.felix.framework.util.SecureAction.stopActivator(SecureAction.java:720)
	at org.apache.felix.framework.Felix.stopBundle(Felix.java:2795)
	at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1557)
	at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
	at java.lang.Thread.run(Thread.java:750)

   Locked ownable synchronizers:
	- <0x00000007208272f8> (a java.util.concurrent.locks.ReentrantLock$FairSync)

@grgrzybek
Copy link
Member Author

The easier deadlock is fixed by rescheduling the start of the context after listener registration in a started context. Proper thread is used to free previous thread's event loop invocation.

@grgrzybek
Copy link
Member Author

Making Whiteboard registrations async (but still synchronized) was a good idea overall, but now some integration tests that wait for "DEPLOYED" events fail (too quick request before the servlet is really available)

grgrzybek added a commit that referenced this issue Feb 20, 2022
…nization. All Whiteboard tests work after making Aries-CDI work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant