Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-72880

Some ServletRegistrations cannot be obtained via ServletContext.getServletRegistration()

    Details

      Description

      Steps to reproduce:

      1. Deploy the attached portlet to Liferay 7.0.2-ga3. Make sure to strip off the version suffix before deploying:
      cp ~/Downloads/com.liferay.faces.demo.primepush.cdi.counter.portlet-4.1.0-SNAPSHOT.war /your/liferay/portal/deploy/com.liferay.faces.demo.primepush.cdi.counter.portlet.war
      

      If the bug still exists, the following exception will appear in the logs:

      java.lang.IllegalStateException: Unable to configure jsr356 at that stage. No Servlet associated with Push Servlet
              at org.atmosphere.util.IOUtils.guestRawServletPath(IOUtils.java:275)
              at org.atmosphere.util.IOUtils.guestServletPath(IOUtils.java:248)
              at org.primefaces.push.impl.PushEndpointMapper.configure(PushEndpointMapper.java:45)
              at org.atmosphere.cpr.AtmosphereFramework.initEndpointMapper(AtmosphereFramework.java:1787)
              at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:911)
              at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:838)
              at org.primefaces.push.PushServlet.configureFramework(PushServlet.java:84)
              at org.primefaces.push.PushServlet.configureFramework(PushServlet.java:36)
              at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:75)
              at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ServletExceptionAdapter.init(ServletExceptionAdapter.java:56)
              at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.init(EndpointRegistration.java:95)
              at org.eclipse.equinox.http.servlet.internal.context.ContextController.doAddServletRegistration(ContextController.java:575)
              at org.eclipse.equinox.http.servlet.internal.context.ContextController.addServletRegistration(ContextController.java:449)
              at org.eclipse.equinox.http.servlet.internal.customizer.ContextServletTrackerCustomizer.addingService(ContextServletTrackerCustomizer.java:55)
              at org.eclipse.equinox.http.servlet.internal.customizer.ContextServletTrackerCustomizer.addingService(ContextServletTrackerCustomizer.java:1)
              at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
              at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
              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:901)
              at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:917)
              at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
              at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:482)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:1001)
              at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.initServlets(WabBundleProcessor.java:625)
              at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.init(WabBundleProcessor.java:168)
              at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer._initWabBundle(WebBundleDeployer.java:186)
              at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer.doStart(WebBundleDeployer.java:106)
              at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory$WABExtension.start(WabFactory.java:162)
              at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259)
              at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232)
              at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482)
              at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)
              at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
              at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:905)
              at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
              at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
              at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:165)
              at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:75)
              at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:67)
              at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:102)
              at org.eclipse.osgi.container.Module.publishEvent(Module.java:461)
              at org.eclipse.osgi.container.Module.start(Module.java:452)
              at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:454)
              at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:717)
              at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:491)
              at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:437)
              at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:955)
              at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1336)
              at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1)
              at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
              at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
      [Refresh Thread: Equinox Container: 200ebb37-ff46-0017-1136-d9a8bef653e4] ERROR org.atmosphere.cpr.AtmosphereFramework - Failed to initialize Atmosphere Framework
      java.lang.IllegalStateException: Unable to configure jsr356 at that stage
              at org.atmosphere.util.IOUtils.guestRawServletPath(IOUtils.java:292)
              at org.atmosphere.util.IOUtils.guestServletPath(IOUtils.java:248)
              at org.primefaces.push.impl.PushEndpointMapper.configure(PushEndpointMapper.java:45)
              at org.atmosphere.cpr.AtmosphereFramework.initEndpointMapper(AtmosphereFramework.java:1787)
              at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:911)
              at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:838)
              at org.primefaces.push.PushServlet.configureFramework(PushServlet.java:84)
              at org.primefaces.push.PushServlet.configureFramework(PushServlet.java:36)
              at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:75)
              at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ServletExceptionAdapter.init(ServletExceptionAdapter.java:56)
              at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.init(EndpointRegistration.java:95)
              at org.eclipse.equinox.http.servlet.internal.context.ContextController.doAddServletRegistration(ContextController.java:575)
              at org.eclipse.equinox.http.servlet.internal.context.ContextController.addServletRegistration(ContextController.java:449)
              at org.eclipse.equinox.http.servlet.internal.customizer.ContextServletTrackerCustomizer.addingService(ContextServletTrackerCustomizer.java:55)
              at org.eclipse.equinox.http.servlet.internal.customizer.ContextServletTrackerCustomizer.addingService(ContextServletTrackerCustomizer.java:1)
              at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
              at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
              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:901)
              at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:917)
              at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
              at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:482)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:1001)
              at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.initServlets(WabBundleProcessor.java:625)
              at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.init(WabBundleProcessor.java:168)
              at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer._initWabBundle(WebBundleDeployer.java:186)
              at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer.doStart(WebBundleDeployer.java:106)
              at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory$WABExtension.start(WabFactory.java:162)
              at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259)
              at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232)
              at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482)
              at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)
              at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
              at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:905)
              at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
              at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
              at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:165)
              at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:75)
              at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:67)
              at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:102)
              at org.eclipse.osgi.container.Module.publishEvent(Module.java:461)
              at org.eclipse.osgi.container.Module.start(Module.java:452)
              at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:454)
              at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:717)
              at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:491)
              at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:437)
              at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:955)
              at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1336)
              at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1)
              at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
              at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
      19:24:22,432 ERROR [Refresh Thread: Equinox Container: 200ebb37-ff46-0017-1136-d9a8bef653e4][com_liferay_portal_osgi_web_wab_extender:97] Catastrophic initialization failure! Shutting down comliferayfacesdemoprimepushcdicounterportlet WAB due to: java.lang.IllegalStateException: Unable to configure jsr356 at that stage
      javax.servlet.ServletException: java.lang.IllegalStateException: Unable to configure jsr356 at that stage
              at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:955)
              at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:838)
              at org.primefaces.push.PushServlet.configureFramework(PushServlet.java:84)
              at org.primefaces.push.PushServlet.configureFramework(PushServlet.java:36)
              at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:75)
              at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ServletExceptionAdapter.init(ServletExceptionAdapter.java:56)
              at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.init(EndpointRegistration.java:95)
              at org.eclipse.equinox.http.servlet.internal.context.ContextController.doAddServletRegistration(ContextController.java:575)
              at org.eclipse.equinox.http.servlet.internal.context.ContextController.addServletRegistration(ContextController.java:449)
              at org.eclipse.equinox.http.servlet.internal.customizer.ContextServletTrackerCustomizer.addingService(ContextServletTrackerCustomizer.java:55)
              at org.eclipse.equinox.http.servlet.internal.customizer.ContextServletTrackerCustomizer.addingService(ContextServletTrackerCustomizer.java:1)
              at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
              at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
              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:901)
              at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:917)
              at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
              at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:482)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:1001)
              at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.initServlets(WabBundleProcessor.java:625)
              at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.init(WabBundleProcessor.java:168)
              at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer._initWabBundle(WebBundleDeployer.java:186)
              at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer.doStart(WebBundleDeployer.java:106)
              at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory$WABExtension.start(WabFactory.java:162)
              at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259)
              at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232)
              at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482)
              at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)
              at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
              at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:905)
              at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
              at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
              at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:165)
              at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:75)
              at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:67)
              at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:102)
              at org.eclipse.osgi.container.Module.publishEvent(Module.java:461)
              at org.eclipse.osgi.container.Module.start(Module.java:452)
              at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:454)
              at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:717)
              at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:491)
              at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:437)
              at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:955)
              at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1336)
              at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1)
              at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
              at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
      Caused by: java.lang.IllegalStateException: Unable to configure jsr356 at that stage
              at org.atmosphere.util.IOUtils.guestRawServletPath(IOUtils.java:292)
              at org.atmosphere.util.IOUtils.guestServletPath(IOUtils.java:248)
              at org.primefaces.push.impl.PushEndpointMapper.configure(PushEndpointMapper.java:45)
              at org.atmosphere.cpr.AtmosphereFramework.initEndpointMapper(AtmosphereFramework.java:1787)
              at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:911)
              ... 55 more
      

      If the bug is fixed, the exception will not appear, and the portlet will deploy. The portlet will also be able to be added to a page (and hopefully clicking the button will increment the counter).

      More Info:

      Here is the exact line of code that fails in Atmosphere:

      // config.getServletConfig().getServletName() is equal to "Push Servlet"
      // which is declared in the portlet's WEB-INF/web.xml file.
      ServletRegistration s = config.getServletContext().getServletRegistration(config.getServletConfig().getServletName());
      

      Source for the attached portlet: https://github.com/liferay/liferay-faces-bridge-impl/tree/8316618281eb2904a627e2cf4e621cda8815ed31/demo/primepush-cdi-counter-portlet

        Attachments

        1. com.liferay.faces.demo.primepush.cdi.counter.portlet-4.1.0-SNAPSHOT.war
          13.99 MB
          Kyle Stiemann
        2. failed.png
          151 kB
          Hong Zhao
        3. fixed.png
          116 kB
          Hong Zhao
        4. liferay.2017-08-17.log
          4.83 MB
          Hong Zhao

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 7 weeks, 6 days ago

                Packages

                Version Package
                7.0.0 DXP FP23
                7.0.X EE
                7.0.4 CE GA5
                Master