Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-28129

Better error messages for missing dependencies

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 11.1, 2021.0
    • Component/s: Runtime

      Description

      If a Nuxeo component is being loaded but its classloading depends on a missing library, a NoClassDefFoundError is thrown but not caught in a place where we report the component in question, so the error is harder to diagnose and prevents the rest of the startup from being clean.

      For instance:

      ERROR [NuxeoStarter] Exception during startup
      java.lang.NoClassDefFoundError: org/bson/BsonDocument
      	at org.nuxeo.runtime.mongodb.MongoDBComponent.<init>(MongoDBComponent.java:58) ~[nuxeo-runtime-mongodb-10.10-HF15-SNAPSHOT.jar:?]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_212]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_212]
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_212]
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
      	at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
      	at org.nuxeo.runtime.model.impl.ComponentInstanceImpl.createInstance(ComponentInstanceImpl.java:89) ~[nuxeo-runtime-10.10-HF15-SNAPSHOT.jar:?]
      	...
      Caused by: java.lang.ClassNotFoundException: org.bson.BsonDocument
      	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1343) ~[catalina.jar:9.0.14]
      	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1173) ~[catalina.jar:9.0.14]
      	... 61 more
      

      When catching the error better, we can get:

      ERROR [ComponentManager] Failed to instantiate component: org.nuxeo.runtime.mongodb.MongoDBComponent
      org.nuxeo.runtime.RuntimeServiceException: java.lang.NoClassDefFoundError: org/bson/BsonDocument
      	at org.nuxeo.runtime.model.impl.ComponentInstanceImpl.createInstance(ComponentInstanceImpl.java:91) ~[nuxeo-runtime-10.10-HF15-SNAPSHOT.jar:?]
      	...
      Caused by: java.lang.NoClassDefFoundError: org/bson/BsonDocument
      	at org.nuxeo.runtime.mongodb.MongoDBComponent.<init>(MongoDBComponent.java:58) ~[nuxeo-runtime-mongodb-10.10-HF15-SNAPSHOT.jar:?]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_212]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_212]
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_212]
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
      	at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
      	at org.nuxeo.runtime.model.impl.ComponentInstanceImpl.createInstance(ComponentInstanceImpl.java:89) ~[nuxeo-runtime-10.10-HF15-SNAPSHOT.jar:?]
      	... 54 more
      Caused by: java.lang.ClassNotFoundException: org.bson.BsonDocument
      	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1343) ~[catalina.jar:9.0.14]
      	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1173) ~[catalina.jar:9.0.14]
      	at org.nuxeo.runtime.mongodb.MongoDBComponent.<init>(MongoDBComponent.java:58) ~[nuxeo-runtime-mongodb-10.10-HF15-SNAPSHOT.jar:?]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_212]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_212]
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_212]
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
      	at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
      	at org.nuxeo.runtime.model.impl.ComponentInstanceImpl.createInstance(ComponentInstanceImpl.java:89) ~[nuxeo-runtime-10.10-HF15-SNAPSHOT.jar:?]
      	... 54 more
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 10 minutes
                10m