Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-5858

Additional server configured through OSGi factory configurations starts and stops immediately

    XMLWordPrintableJSON

Details

    Description

      When I disable a default server specifying a negative port and configure an additional server  through OSGi factory configurations i get a server started and immediately stopped:

      2018-05-18 08:15:11.149:INFO:oejsh.ContextHandler:CM Configuration Updater (ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Started o.e.j.s.ServletContextHandler@4aefeb72{/,null,AVAILABLE}
      2018-05-18 08:15:11.150:INFO:oejs.Server:CM Configuration Updater (ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Started @1448ms
      2018-05-18 08:15:11.150:INFO:oejs.session:CM Configuration Updater (ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): node0 Scavenging every 660000ms
      2018-05-18 08:15:11.194:INFO:oejs.AbstractConnector:CM Configuration Updater (ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Started ServerConnector@6dfbaedd{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
      2018-05-18 08:15:11.240:INFO:oejus.SslContextFactory:CM Configuration Updater (ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): x509=X509@17c0c47f(budget,h=[],w=[]) for SslContextFactory@4d9ec6f9[provider=null,keyStore=bundleresource://4.fwk1864230087/etc/keystore/keystore,trustStore=null]
      2018-05-18 08:15:11.517:INFO:oejs.AbstractConnector:CM Configuration Updater (ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Started ServerConnector@feb016f{SSL,[ssl, http/1.1]}{0.0.0.0:8443}
      2018-05-18 08:15:12.102:INFO:oejs.AbstractConnector:CM Configuration Updater (ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Stopped ServerConnector@6dfbaedd{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
      2018-05-18 08:15:12.104:INFO:oejs.AbstractConnector:CM Configuration Updater (ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Stopped ServerConnector@feb016f{SSL,[ssl, http/1.1]}{0.0.0.0:8443}
      2018-05-18 08:15:12.104:INFO:oejs.session:CM Configuration Updater (ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): node0 Stopped scavenging
      2018-05-18 08:15:12.105:INFO:oejsh.ContextHandler:CM Configuration Updater (ManagedServiceFactory Update: factoryPid=[org.apache.felix.http]): Stopped o.e.j.s.ServletContextHandler@4aefeb72{/,null,UNAVAILABLE}
      
      

      Checking code of Jetty activator I see, that it stops factory on ungetting it.

      final Dictionary<String, Object> factoryProps = new Hashtable<>();
      factoryProps.put(Constants.SERVICE_PID, JettyService.PID);
      factoryProps.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
      factoryProps.put(Constants.SERVICE_DESCRIPTION, "Managed Service Factory for the Jetty Http Service");
      this.jettyServiceFactoryReg = this.getBundleContext().registerService("org.osgi.service.cm.ManagedServiceFactory",
      new ServiceFactory()
      {
      
      @Override
      public Object getService(final Bundle bundle,
      final ServiceRegistration registration)
      {
      return new JettyManagedServiceFactory(getBundleContext());
      }
      
      @Override
      public void ungetService(final Bundle bundle,
      final ServiceRegistration registration,
      final Object service)
      {
      ((JettyManagedServiceFactory)service).stop();
      }
      }, factoryProps);
      
      

      It should not happen actually, because it shutdowns the server.

      Please fix it.

      Attachments

        Issue Links

          Activity

            People

              cziegeler Carsten Ziegeler
              Smushkevich Roman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: