-
Type: Improvement
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Component/s: Runtime
-
Tags:
-
Sprint:nxFG 11.1.10
-
Story Points:0
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