-
Type: Bug
-
Status: Resolved
-
Priority: Minor
-
Resolution: Won't Do
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Core VCS
-
Tags:
-
Team:PLATFORM
Bug
cd nuxeo-core/nuxeo-core-storage-sql/nuxeo-core-storage-sql-test/ mvn -nsu test -Dnuxeo.test.vcs.db=Derby -Dtest=TestSQLBackendSequenceId
generates:
[2020-02-16T07:06:47.812Z] [INFO] Running org.nuxeo.ecm.core.storage.sql.TestSQLBackendSequenceId [2020-02-16T07:06:47.812Z] [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.012 s <<< FAILURE! - in org.nuxeo.ecm.core.storage.sql.TestSQLBackendSequenceId [2020-02-16T07:06:47.812Z] [ERROR] org.nuxeo.ecm.core.storage.sql.TestSQLBackendSequenceId Time elapsed: 0.01 s <<< FAILURE! [2020-02-16T07:06:47.812Z] java.lang.AssertionError: invoke on features error [Holder [type=class org.nuxeo.runtime.test.runner.MDCFeature], Holder [type=class org.nuxeo.runtime.test.runner.ConditionalIgnoreRule$Feature], Holder [type=class org.nuxeo.runtime.test.runner.RandomBug$Feature], Holder [type=class org.nuxeo.runtime.test.runner.WithFrameworkPropertyFeature], Holder [type=class org.nuxeo.runtime.test.runner.RuntimeFeature], Holder [type=class org.nuxeo.runtime.test.runner.TransactionalFeature], Holder [type=class org.nuxeo.ecm.core.storage.sql.SQLBackendFeature]] [2020-02-16T07:06:47.812Z] at org.nuxeo.runtime.test.runner.FeaturesLoader.apply(FeaturesLoader.java:114) [2020-02-16T07:06:47.812Z] at org.nuxeo.runtime.test.runner.FeaturesLoader.apply(FeaturesLoader.java:104) [2020-02-16T07:06:47.812Z] at org.nuxeo.runtime.test.runner.FeaturesRunner.start(FeaturesRunner.java:192) [2020-02-16T07:06:47.812Z] at org.nuxeo.runtime.test.runner.FeaturesRunner$BeforeClassStatement.evaluate(FeaturesRunner.java:230) [2020-02-16T07:06:47.812Z] at org.junit.rules.RunRules.evaluate(RunRules.java:20) [2020-02-16T07:06:47.812Z] at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) [2020-02-16T07:06:47.812Z] at org.junit.runners.ParentRunner.run(ParentRunner.java:413) [2020-02-16T07:06:47.812Z] at org.junit.runners.Suite.runChild(Suite.java:128) [2020-02-16T07:06:47.812Z] at org.junit.runners.Suite.runChild(Suite.java:27) [2020-02-16T07:06:47.812Z] at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) [2020-02-16T07:06:47.812Z] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) [2020-02-16T07:06:47.812Z] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) [2020-02-16T07:06:47.812Z] at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) [2020-02-16T07:06:47.812Z] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) [2020-02-16T07:06:47.812Z] at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) [2020-02-16T07:06:47.812Z] at org.junit.runners.ParentRunner.run(ParentRunner.java:413) [2020-02-16T07:06:47.812Z] at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55) [2020-02-16T07:06:47.812Z] at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137) [2020-02-16T07:06:47.812Z] at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107) [2020-02-16T07:06:47.812Z] at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83) [2020-02-16T07:06:47.812Z] at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75) [2020-02-16T07:06:47.812Z] at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:158) [2020-02-16T07:06:47.812Z] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384) [2020-02-16T07:06:47.812Z] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345) [2020-02-16T07:06:47.812Z] at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126) [2020-02-16T07:06:47.812Z] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418) [2020-02-16T07:06:47.812Z] Suppressed: java.lang.NoClassDefFoundError: org/apache/derby/shared/common/security/SystemPermission [2020-02-16T07:06:47.812Z] at org.apache.derby.iapi.jdbc.AutoloadedDriver.connect(AutoloadedDriver.java:134) [2020-02-16T07:06:47.812Z] at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677) [2020-02-16T07:06:47.812Z] at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228) [2020-02-16T07:06:47.812Z] at org.nuxeo.ecm.core.storage.sql.DatabasePostgreSQL.setUp(DatabasePostgreSQL.java:74) [2020-02-16T07:06:47.812Z] at org.nuxeo.ecm.core.storage.sql.SQLBackendFeature.start(SQLBackendFeature.java:66) [2020-02-16T07:06:47.812Z] at org.nuxeo.runtime.test.runner.FeaturesRunner.lambda$start$5(FeaturesRunner.java:192) [2020-02-16T07:06:47.812Z] at org.nuxeo.runtime.test.runner.FeaturesLoader.apply(FeaturesLoader.java:117) [2020-02-16T07:06:47.812Z] ... 25 more [2020-02-16T07:06:47.812Z] Caused by: java.lang.ClassNotFoundException: org.apache.derby.shared.common.security.SystemPermission [2020-02-16T07:06:47.812Z] at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) [2020-02-16T07:06:47.812Z] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) [2020-02-16T07:06:47.812Z] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) [2020-02-16T07:06:47.812Z] ... 32 more
Cause
Since NXP-28537, the Apache Derby library has been upgraded from 10.14.2.0 to 10.15.1.3.
Yet, starting from 10.15.1.3, the derbyshared.jar additional library is required in the classpath.
See http://apache-database.10148.n7.nabble.com/ANNOUNCE-Apache-Derby-10-15-1-3-released-td150150.html.
Thus the error, the SystemPermission having been moved from the derby lib itself (was the case in 10.14.2.0) to another lib.
Bug Origin
This use case is hard to detect as there is no reason to run unit tests with Derby.
Yet, trying to run them against an existing PostgreSQL database with a bad configuration (let's say the nuxeo.test.vcs.server property set to a wrong database server name), I ran into it because:
- java.sql.DriverManager uses the java.util.ServiceLoader to load any driver available in the classpath
- derby is in the classpath => derby is loaded
- any loaded driver self-registers itself to the DriverManager
- the DriverManager iterates on the registered drivers to try a connection
- the PostgeSQL connection fails
- derby was the next one in the list