Platform: debian 9.6 "stretch", openjdk-8 8u181-b13-2~deb9u1, maven 3.3.9, pax exam 4.10.0
When I add some maven dependencies with <scope>provided</scope>, without changing anything else, my karaf-based pax exam test starts failing. Is this expected? My initial feeling was that adding "provided" dependencies would make it possible to compile classes with those dependencies, but should not affect the runtime. Some details 1. The pax exam test that worked before I added my dependencies (and returns to working if I remove them) https://github.com/steinarb/ukelonn/blob/master/ukelonn.tests/src/test/java/no/priv/bang/ukelonn/tests/UkelonnServiceIntegrationTest.java#L45 2. I am working on a pull request to make MockHttpServletRequest and MockHttpServletResponse of mockrunner-servlet become available to pax exam tests, by making mockrunner-servlet and its dependency mockrunner-core become OSGi bundles https://github.com/mockrunner/mockrunner/issues/56 3. My fix-branch for creating a pull request for the mockrunner issue. Note! This branch may be squashed and rebased before making it into a pull request https://github.com/steinarb/mockrunner/tree/make-jars-be-osgi-bundles 4. I've added dependencies to the dependencyManagement section of the parent POM: <properties> <mockrunner.version>2.0.2-SNAPSHOT</mockrunner.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>com.mockrunner</groupId> <artifactId>mockrunner-core</artifactId> <version>${mockrunner.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>com.mockrunner</groupId> <artifactId>mockrunner-servlet</artifactId> <version>${mockrunner.version}</version> <scope>test</scope> </dependency> </dependencies> </dependencyManagement> (the "test" scope is because I'm using the MockHttpServletRequest and MockHttpServletResponse in regular unit tests) 5. I've added dependencies to the pom of the ukelonn.tests projects (no Java code changes yet, those were to come next): <dependencies> <dependency> <groupId>com.mockrunner</groupId> <artifactId>mockrunner-core</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>com.mockrunner</groupId> <artifactId>mockrunner-servlet</artifactId> <scope>provided</scope> </dependency> </dependencies> 6. The test shows normal output for karaf starting up and then quiet for a long time until the tests time out [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Dec 28, 2018 10:48:42 AM org.apache.karaf.main.Main launch INFO: Installing and starting initial bundles Dec 28, 2018 10:48:42 AM org.apache.karaf.main.Main launch INFO: All initial bundles installed and set to start Dec 28, 2018 10:48:42 AM org.apache.karaf.main.lock.SimpleFileLock lock INFO: Trying to lock /home/sb/workspaces/ws03/ukelonn/ukelonn.tests/target/exam/d0af686b-4731-47fa-aab1-3a1b19127934/lock Dec 28, 2018 10:48:42 AM org.apache.karaf.main.lock.SimpleFileLock lock INFO: Lock acquired Dec 28, 2018 10:48:42 AM org.apache.karaf.main.Main$KarafLockCallback lockAquired INFO: Lock acquired. Setting startlevel to 100 [ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 720.545 s <<< FAILURE! - in no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest [ERROR] no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest Time elapsed: 720.543 s <<< ERROR! java.lang.RuntimeException: Cannot get the remote bundle context Caused by: java.rmi.NotBoundException: 66b548e0-d5ef-4830-b25a-7c709e11b9d5 [ERROR] no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest Time elapsed: 720.545 s <<< ERROR! java.lang.RuntimeException: Container never came up at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) 7. The karaf.log shows initial output and that it stops before loading any features: Dec 28, 2018 10:48:42 AM org.apache.karaf.main.Main launch INFO: Installing and starting initial bundles Dec 28, 2018 10:48:42 AM org.apache.karaf.main.Main launch INFO: All initial bundles installed and set to start Dec 28, 2018 10:48:42 AM org.apache.karaf.main.lock.SimpleFileLock lock INFO: Trying to lock /home/sb/workspaces/ws03/ukelonn/ukelonn.tests/target/exam/d0af686b-4731-47fa-aab1-3a1b19127934/lock Dec 28, 2018 10:48:42 AM org.apache.karaf.main.lock.SimpleFileLock lock INFO: Lock acquired Dec 28, 2018 10:48:42 AM org.apache.karaf.main.Main$KarafLockCallback lockAquired INFO: Lock acquired. Setting startlevel to 100 8. I ran "mvn dependency:tree" to see what the introduced dependencies looked like: [INFO] +- com.mockrunner:mockrunner-core:jar:2.0.2-SNAPSHOT:provided [INFO] | +- jdom:jdom:jar:1.0:provided [INFO] | +- oro:oro:jar:2.0.8:provided [INFO] | +- com.kirkk:jaranalyzer:jar:1.2:provided [INFO] | | +- bcel:bcel:jar:5.1:provided [INFO] | | | \- regexp:regexp:jar:1.2:provided [INFO] | | +- jakarta-regexp:jakarta-regexp:jar:1.4:provided [INFO] | | \- ant:ant:jar:1.6.5:provided [INFO] | \- nekohtml:nekohtml:jar:0.9.5:provided [INFO] | \- xerces:xercesImpl:jar:2.4.0:provided [INFO] +- com.mockrunner:mockrunner-servlet:jar:2.0.2-SNAPSHOT:provided [INFO] | +- com.mockrunner:mockrunner-core:xml:features:2.0.2-SNAPSHOT:provided [INFO] | +- commons-logging:commons-logging:jar:1.0.4:compile [INFO] | +- org.apache.tomcat:servlet-api:jar:6.0.37:provided [INFO] | \- org.apache.tomcat:jasper:jar:6.0.37:provided [INFO] | +- org.apache.tomcat:juli:jar:6.0.37:provided [INFO] | +- org.apache.tomcat:jsp-api:jar:6.0.37:provided [INFO] | +- org.apache.tomcat:catalina:jar:6.0.37:provided [INFO] | | \- org.apache.tomcat:annotations-api:jar:6.0.37:provided [INFO] | +- org.apache.tomcat:el-api:jar:6.0.37:provided [INFO] | +- org.eclipse.jdt.core.compiler:ecj:jar:4.2.2:provided [INFO] | \- org.apache.tomcat:jasper-el:jar:6.0.37:provided 9. I excluded the commons-logging dependency that had scope compile <dependencies> <dependency> <groupId>com.mockrunner</groupId> <artifactId>mockrunner-servlet</artifactId> <scope>provided</scope> <exclusions> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> </exclusions> </dependency> </dependencies> 10. This made no difference I could see in the output from the maven build [INFO] --- maven-surefire-plugin:2.20:test (default-test) @ ukelonn.tests --- [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Dec 28, 2018 11:24:01 AM org.apache.karaf.main.Main launch INFO: Installing and starting initial bundles Dec 28, 2018 11:24:01 AM org.apache.karaf.main.Main launch INFO: All initial bundles installed and set to start Dec 28, 2018 11:24:01 AM org.apache.karaf.main.lock.SimpleFileLock lock INFO: Trying to lock /home/sb/workspaces/ws03/ukelonn/ukelonn.tests/target/exam/72ae121c-3e79-422e-a5a6-6985c16e8238/lock Dec 28, 2018 11:24:01 AM org.apache.karaf.main.lock.SimpleFileLock lock INFO: Lock acquired Dec 28, 2018 11:24:01 AM org.apache.karaf.main.Main$KarafLockCallback lockAquired INFO: Lock acquired. Setting startlevel to 100 [ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 720.517 s <<< FAILURE! - in no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest [ERROR] no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest Time elapsed: 720.516 s <<< ERROR! java.lang.RuntimeException: Cannot get the remote bundle context Caused by: java.rmi.NotBoundException: ed2778fb-26e7-49df-8545-c51a70814011 [ERROR] no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest Time elapsed: 720.517 s <<< ERROR! java.lang.RuntimeException: Container never came up at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) 11. The karaf.log also looked the same: it stops at the point where the working variant of the test (ie. without the mockrunner dependencies) starts loading the features Dec 28, 2018 11:24:01 AM org.apache.karaf.main.Main launch INFO: Installing and starting initial bundles Dec 28, 2018 11:24:01 AM org.apache.karaf.main.Main launch INFO: All initial bundles installed and set to start Dec 28, 2018 11:24:01 AM org.apache.karaf.main.lock.SimpleFileLock lock INFO: Trying to lock /home/sb/workspaces/ws03/ukelonn/ukelonn.tests/target/exam/72ae121c-3e79-422e-a5a6-6985c16e8238/lock Dec 28, 2018 11:24:01 AM org.apache.karaf.main.lock.SimpleFileLock lock INFO: Lock acquired Dec 28, 2018 11:24:01 AM org.apache.karaf.main.Main$KarafLockCallback lockAquired INFO: Lock acquired. Setting startlevel to 100 Does anyone have any idea why adding these maven dependencies makes the test fail? Thanks! - Steinar -- -- ------------------ OPS4J - http://www.ops4j.org - ops4j@googlegroups.com --- You received this message because you are subscribed to the Google Groups "OPS4J" group. To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.