1

I'm trying to run tests with Microshed and Testcontainers but having a hard time with dependencies issues I have these deps on my build.gradle:

dependencies {
    providedCompile 'org.eclipse.microprofile:microprofile:6.0'   
    providedCompile 'jakarta.platform:jakarta.jakartaee-api:10.0.0'
    testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3'
    testImplementation 'org.testcontainers:testcontainers:1.18.3'
    testImplementation 'org.microshed:microshed-testing-liberty:0.9.1'
    testImplementation 'javax.ws.rs:javax.ws.rs-api:2.1.1'
    testImplementation 'org.jboss.resteasy:resteasy-client:6.2.4.Final'
    testImplementation 'org.jboss.resteasy:resteasy-json-binding-provider:6.2.4.Final'
    testImplementation 'org.eclipse:yasson:3.0.3'
    testImplementation 'org.slf4j:slf4j-jdk14:2.0.7'
}

but getting the CNF error during test run

        Caused by:
        java.lang.ClassNotFoundException: javax.annotation.Resource
            at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
            at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
            at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
            ... 78 more

tried different sample projects from Openliberty and Microshed repo but none seems to work with the latest OL version (23.0.0.x)

The OL server starts with o problem. But the IT fails during execution due to CL issues.

  • Can you post the full exception stack? First thing I notice is that you are importing both `jakartaee-api:10.0.0` and `javax.ws.rs-api:2.1.1` these APIs are from different releases and incompatible. If you want to use Jakarta EE 10 then you'll want to switch to the EE10 version of RESTful Web Services – KyleAure Jun 12 '23 at 15:13
  • @KyleAure here is my reproducer https://github.com/rafaeltuelho/openliberty-devfile-stack-starters/tree/microshed-tests – Rafael Soares - tuelho Jun 12 '23 at 15:15
  • To narrowly answer your question, you could add `testImplementation 'javax.annotation:javax.annotation-api:1.3.2'` . (I didn't check if that's the best version...but something like that). But behind this narrow question there's the bigger question "How should I use MicroShed Testing (MST) with Open Liberty to test EE 10 / MP 6 services?" which doesn't have a great answer. It'd seem to require more MST enhancement. Even if using EE 8 on the test side and EE 10 on the server might get you through some scenarios, I'd imagine there's more problems ahead. – Scott Kurz Jun 13 '23 at 01:45
  • @ScottKurz, thanks for your comment. Yeah, I agree with you on more MST enhancement. Looking at their github org it seems they are in low pace at the moment. Not much activity there. Anyway, looking from a DevX perspective, it's been hard to implement IT testing with OL. Tried with Arquillian and MST, but not success. Followed many samples. None of them seems to work with EE10 and MP 6 on OL 23.x... Always falling into ClassLoader/Dependency hell, plus lack of consistent doc/guidance. – Rafael Soares - tuelho Jun 13 '23 at 10:59

0 Answers0