reportportal / agent-java-cucumber4

Cucumber JVM version [4.0.0; 5.0.0) adapter
Apache License 2.0
6 stars 9 forks source link

NoSuchMethodError `com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z` is thrown with version 5.0.0-BETA-9 #43

Closed kzokv closed 4 years ago

kzokv commented 4 years ago

Hi, I couldn't run my tests on reportportal with below dependencies and config:

env: https://beta.demo.reportportal.io/
agent-java-cucumber4: 5.0.0-BETA-9
cucumber-java: 4.8.0
cucumber-testng: 4.8.0

TestRunner:

@CucumberOptions(features = "src/test/java/auto",
        glue = {"pakcages..."},
        tags = {"@dev"},
        plugin = {"pretty", "com.epam.reportportal.cucumber.ScenarioReporter"}
)

public class TestRunner {
    private TestNGCucumberRunner testNGCucumberRunner;

    @BeforeClass(alwaysRun = true)
    public void setUpClass(ITestContext iTestContext) throws Throwable {
        new AnnotationConfigApplicationContext(AxnCoreQaBeans.class);
        ContextHelper.setiTestContext(iTestContext);
        testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
    }

    @Test(description = "Runs Cucumber Scenario", dataProvider = "scenario")
    public void feature(PickleEventWrapper eventWrapper, CucumberFeatureWrapper cucumberFeature) throws Throwable {
        testNGCucumberRunner.runScenario(eventWrapper.getPickleEvent());
    }

    @DataProvider(parallel = true)
    public Object[][] scenario() {
        return testNGCucumberRunner.provideScenarios();
    }

    @AfterClass(alwaysRun = true)
    public void tearDownClass() throws Exception {
        testNGCucumberRunner.finish();
    }
}

Exception:

java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
    at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:571)
    at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:480)
    at com.epam.reportportal.service.ReportPortal$Builder.buildRestEndpoint(ReportPortal.java:390)
    at com.epam.reportportal.service.ReportPortal$Builder.buildClient(ReportPortal.java:380)
    at com.epam.reportportal.service.ReportPortal$Builder.build(ReportPortal.java:361)
    at com.epam.reportportal.cucumber.AbstractReporter.buildReportPortal(AbstractReporter.java:116)
    at com.epam.reportportal.cucumber.AbstractReporter$1.get(AbstractReporter.java:183)
    at com.epam.reportportal.cucumber.AbstractReporter$1.get(AbstractReporter.java:176)
    at rp.com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:167)
    at com.epam.reportportal.cucumber.ScenarioReporter$1.get(ScenarioReporter.java:149)
    at com.epam.reportportal.cucumber.ScenarioReporter$1.get(ScenarioReporter.java:142)
    at rp.com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:167)
    at com.epam.reportportal.cucumber.ScenarioReporter.getRootItemId(ScenarioReporter.java:121)
    at com.epam.reportportal.cucumber.AbstractReporter.createFeatureContext(AbstractReporter.java:436)
    at com.epam.reportportal.cucumber.AbstractReporter.handleStartOfTestCase(AbstractReporter.java:403)
    at com.epam.reportportal.cucumber.AbstractReporter.access$000(AbstractReporter.java:50)
    at com.epam.reportportal.cucumber.AbstractReporter$4.receive(AbstractReporter.java:330)
    at com.epam.reportportal.cucumber.AbstractReporter$4.receive(AbstractReporter.java:327)
    at cucumber.runner.AbstractEventPublisher.send(AbstractEventPublisher.java:45)
    at cucumber.runner.AbstractEventBus.send(AbstractEventBus.java:9)
    at cucumber.runner.TimeServiceEventBus.send(TimeServiceEventBus.java:3)
    at cucumber.runner.ThreadLocalRunnerSupplier$SynchronizedEventBus.send(ThreadLocalRunnerSupplier.java:93)
    at cucumber.runner.ThreadLocalRunnerSupplier$LocalEventBus.send(ThreadLocalRunnerSupplier.java:61)
    at cucumber.runner.TestCase.run(TestCase.java:38)
    at cucumber.runner.Runner.runPickle(Runner.java:50)
    at io.cucumber.testng.TestNGCucumberRunner.runScenario(TestNGCucumberRunner.java:79)
    at auto.TestRunner.feature(TestRunner.java:39)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
... Removed 9 stack frames
(Runs Cucumber Scenario)
HardNorth commented 4 years ago

@kzokv I wasn't able to reproduce your case. I even updated our examples in a separate branch to conform your setup, but with no luck, see this branch: https://github.com/reportportal/examples-java/tree/cucumber4-jackson-no-method And this runner: https://github.com/reportportal/examples-java/blob/cucumber4-jackson-no-method/example-cucumber4/src/test/java/TestRunner.java

After some digging into details I can tell that the most probable case here is that you have your own dependencies on 'jackson-databind' and 'jackson-annotations' which version less than 2.3 (older than 26-Oct-2013).

I can't tell which minimal Jackson version is supported by ReportPortal, but in our agents it is set to '2.9.9'.

I'm closing that issue, because I believe there is no such issue in RP, but rather in your build system configuration. You can re-open it if you provide me an example project which reproduces the issue.