Uploaded image for project: 'ONOS'
  1. ONOS
  2. ONOS-8026

Application using org.onosproject.restsb and ServerSentEvents crashes during its activation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.0
    • Fix Version/s: None
    • Component/s: None
    • Environment:

      OS: Ubuntu 16.04.6 LTS

      Docker: docker-ce 5:19.03.1~3-0~ubuntu-xenial

      ONOS: 2.1.0 running in Docker, also tested with 2.2.0 (docker latest)

      Description

      I'm implementing an ONOS Device Driver that uses REST Southbound Provider to configure the devices and ServerSentEvents to receive notifications from them.

      I have modified the POM file adding:

      <properties>
        ...
        <onos.app.requires>org.onosproject.restsb</onos.app.requires>
      </properties>
      
      <dependencies>
        ...
        <dependency>
          <groupId>org.onosproject</groupId>
          <artifactId>onos-protocols-rest-api</artifactId>
          <version>${onos.version}</version>
        </dependency>
        <dependency>
          <groupId>org.glassfish.jersey.media</groupId>
          <artifactId>jersey-media-sse</artifactId>
          <version>2.27</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
      

      When ONOS activates the application for the first time, it installs and starts some of the bundles, but not the one for "jersey-media-sse":

      18:06:19.915 INFO  [ApplicationManager] Application edu.upc.ac.gco.onos.cursasq has been installed
      18:06:31.730 INFO  [FeaturesServiceImpl] Adding features: onos-providers-rest/[2.1.0,2.1.0]
      18:06:32.400 INFO  [FeaturesServiceImpl] Changes to perform:
      18:06:32.401 INFO  [FeaturesServiceImpl]   Region: root
      18:06:32.402 INFO  [FeaturesServiceImpl]     Bundles to install:
      18:06:32.402 INFO  [FeaturesServiceImpl]       mvn:org.apache.httpcomponents/httpclient-osgi/4.5.1/jar
      18:06:32.402 INFO  [FeaturesServiceImpl]       mvn:org.apache.httpcomponents/httpcore-osgi/4.4.4/jar
      18:06:32.403 INFO  [FeaturesServiceImpl]       wrap:mvn:org.glassfish.jersey.security/oauth2-client/2.27$Bundle-SymbolicName=org.glassfish.jersey.security.oauth2-client&Bundle-Version=2.27
      18:06:32.403 INFO  [FeaturesServiceImpl]       mvn:org.onosproject/onos-protocols-rest-api/2.1.0
      18:06:32.404 INFO  [FeaturesServiceImpl]       mvn:org.onosproject/onos-protocols-rest-ctl/2.1.0
      18:06:32.404 INFO  [FeaturesServiceImpl]       mvn:org.onosproject/onos-providers-rest-device/2.1.0
      18:06:32.405 INFO  [FeaturesServiceImpl] Installing bundles:
      18:06:32.406 INFO  [FeaturesServiceImpl]   mvn:org.apache.httpcomponents/httpclient-osgi/4.5.1/jar
      18:06:32.413 INFO  [FeaturesServiceImpl]   mvn:org.apache.httpcomponents/httpcore-osgi/4.4.4/jar
      18:06:32.419 INFO  [FeaturesServiceImpl]   wrap:mvn:org.glassfish.jersey.security/oauth2-client/2.27$Bundle-SymbolicName=org.glassfish.jersey.security.oauth2-client&Bundle-Version=2.27
      18:06:32.422 INFO  [FeaturesServiceImpl]   mvn:org.onosproject/onos-protocols-rest-api/2.1.0
      18:06:32.425 INFO  [FeaturesServiceImpl]   mvn:org.onosproject/onos-protocols-rest-ctl/2.1.0
      18:06:32.430 INFO  [FeaturesServiceImpl]   mvn:org.onosproject/onos-providers-rest-device/2.1.0
      18:06:32.487 INFO  [FeaturesServiceImpl] Starting bundles:
      18:06:32.490 INFO  [FeaturesServiceImpl]   org.apache.httpcomponents.httpcore/4.4.4
      18:06:32.492 INFO  [FeaturesServiceImpl]   org.apache.httpcomponents.httpclient/4.5.1
      18:06:32.499 INFO  [FeaturesServiceImpl]   org.glassfish.jersey.security.oauth2-client/2.27.0
      18:06:32.501 INFO  [FeaturesServiceImpl]   org.onosproject.onos-protocols-rest-api/2.1.0
      18:06:32.502 INFO  [FeaturesServiceImpl]   org.onosproject.onos-protocols-rest-ctl/2.1.0
      18:06:32.516 INFO  [RestSBControllerImpl] Started
      18:06:32.518 INFO  [FeaturesServiceImpl]   org.onosproject.onos-providers-rest-device/2.1.0
      18:06:32.540 INFO  [RestDeviceProvider] Started
      18:06:32.541 INFO  [FeaturesServiceImpl] Done.
      18:06:32.542 INFO  [ApplicationManager] Application org.onosproject.restsb has been activated
      18:06:32.550 INFO  [FeaturesServiceImpl] Adding features: cursasq/[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]
      18:06:32.789 INFO  [RestDeviceProvider] Configured. Poll frequency = 30 seconds, reply timeout = 5 seconds 
      18:06:33.142 INFO  [FeaturesServiceImpl] Changes to perform:
      18:06:33.143 INFO  [FeaturesServiceImpl]   Region: root
      18:06:33.143 INFO  [FeaturesServiceImpl]     Bundles to install:
      18:06:33.144 INFO  [FeaturesServiceImpl]       mvn:edu.upc.ac.gco.onos/cursasq/1.0-SNAPSHOT
      18:06:33.145 INFO  [FeaturesServiceImpl] Installing bundles:
      18:06:33.146 INFO  [FeaturesServiceImpl]   mvn:edu.upc.ac.gco.onos/cursasq/1.0-SNAPSHOT
      18:06:33.173 INFO  [FeaturesServiceImpl] Starting bundles:
      18:06:33.174 INFO  [FeaturesServiceImpl]   edu.upc.ac.gco.onos.cursasq/1.0.0.SNAPSHOT
      18:06:33.180 INFO  [CursaSQDeviceEventsListener] Started
      18:06:33.188 INFO  [CursaSQDriversLoader] Started
      18:06:33.199 INFO  [CursaSQLinkProvider] Started
      18:06:33.200 INFO  [FeaturesServiceImpl] Done.
      18:06:33.203 INFO  [ApplicationManager] Application edu.upc.ac.gco.onos.cursasq has been activated
      

      ONOS reports that application was started successfully, but when startServerSentEvents() method is executed, ONOS throws the following exception:

      18:07:51.086 ERROR [CursaSQDevicesDiscovery] [getDeviceDetails] Failed to discover device(rest:172.17.0.1:8081) details: {}
      java.lang.RuntimeException: java.lang.ClassNotFoundException: org.glassfish.jersey.media.sse.internal.JerseySseEventSource$Builder not found by javax.ws.rs-api [167]
      	at javax.ws.rs.sse.SseEventSource$Builder.newBuilder(SseEventSource.java:153)
      	at javax.ws.rs.sse.SseEventSource.target(SseEventSource.java:238)
      	at org.onosproject.protocol.http.ctl.HttpSBControllerImpl.getServerSentEvents(HttpSBControllerImpl.java:283)
      	at org.onosproject.protocol.rest.ctl.RestSBControllerImpl.startServerSentEvents(RestSBControllerImpl.java:139)
      	at edu.upc.ac.gco.onos.cursasq.CursaSQDevicesDiscovery.getDeviceDetails(CursaSQDevicesDiscovery.java:166)
      	at edu.upc.ac.gco.onos.cursasq.CursaSQDevicesDiscovery.deviceDetails(CursaSQDevicesDiscovery.java:103)
      	at org.onosproject.provider.rest.device.impl.RestDeviceProvider.deviceAdded(RestDeviceProvider.java:361)
      	at org.onosproject.provider.rest.device.impl.RestDeviceProvider.connectDevice(RestDeviceProvider.java:523)
      	at org.onosproject.provider.rest.device.impl.RestDeviceProvider.access$400(RestDeviceProvider.java:110)
      	at org.onosproject.provider.rest.device.impl.RestDeviceProvider$InternalNetworkConfigListener.lambda$event$1(RestDeviceProvider.java:621)
      	at org.onosproject.provider.rest.device.impl.RestDeviceProvider.lambda$exceptionSafe$10(RestDeviceProvider.java:594)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.media.sse.internal.JerseySseEventSource$Builder not found by javax.ws.rs-api [167]
      	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639)
      	at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
      	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
      	at java.base/java.lang.Class.forName0(Native Method)
      	at java.base/java.lang.Class.forName(Class.java:315)
      	at javax.ws.rs.sse.FactoryFinder.newInstance(FactoryFinder.java:111)
      	at javax.ws.rs.sse.FactoryFinder.find(FactoryFinder.java:209)
      	at javax.ws.rs.sse.SseEventSource$Builder.newBuilder(SseEventSource.java:137)
      	... 13 more
      18:07:51.094 ERROR [RestDeviceProvider] Unhandled Exception
      java.lang.NullPointerException: DeviceDescription cannot be null
      	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:799)
      	at org.onosproject.provider.rest.device.impl.RestDeviceProvider.deviceAdded(RestDeviceProvider.java:362)
      	at org.onosproject.provider.rest.device.impl.RestDeviceProvider.connectDevice(RestDeviceProvider.java:523)
      	at org.onosproject.provider.rest.device.impl.RestDeviceProvider.access$400(RestDeviceProvider.java:110)
      	at org.onosproject.provider.rest.device.impl.RestDeviceProvider$InternalNetworkConfigListener.lambda$event$1(RestDeviceProvider.java:621)
      	at org.onosproject.provider.rest.device.impl.RestDeviceProvider.lambda$exceptionSafe$10(RestDeviceProvider.java:594)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:834)

      If you need further information to check the issue, let me know.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            lgifre Lluis Gifre
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: