java.lang.NullPointerException:JsonObjects名称/值对中的值不能为null

问题描述 投票:0回答:1

我正在尝试自动化应用程序的E2E流程。我完成了selenium脚本,它在我当地工作正常。但是当我试图在Jenkins中运行它时,Jenkins在编译程序后显示以下异常。你能帮我摆脱它吗?我注意到Git下载成功,所有必需的文件和文件夹名称都是正确的。

java.io.IOException: The system cannot find the path specified
    at java.io.WinNTFileSystem.createFileExclusively(Native Method)
    at java.io.File.createNewFile(File.java:1012)
    at com.homer.logger.HomerLogger.addFileHandler(HomerLogger.java:79)
    at com.homer.logger.HomerLogger.getInstance(HomerLogger.java:45)
    at com.homer.setup.NonBDDRunner.runTCOneIteration(NonBDDRunner.java:353)
    at com.homer.setup.NonBDDRunner.runOneIteration(NonBDDRunner.java:157)
    at com.homer.interfaceimpl.NonBDDRunTestCases.runTestCase(NonBDDRunTestCases.java:63)
    at com.homer.setup.BaseRunner.executeTestCases(BaseRunner.java:122)
    at com.homer.setup.BaseRunner.executeSeleniumTestCases(BaseRunner.java:59)
    at com.homer.setup.BaseRunner.runTestCases(BaseRunner.java:41)
    at com.homer.setup.RunManager.runTestCases(RunManager.java:121)
    at com.homer.setup.RunManager.runTestCases(RunManager.java:36)
    at com.homer.runner.HomerRunner.main(HomerRunner.java:38)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:294)
    at java.lang.Thread.run(Thread.java:745)

java.lang.NullPointerException: Value in JsonObjects name/value pair cannot be null
    at org.glassfish.json.JsonObjectBuilderImpl.validateValue(JsonObjectBuilderImpl.java:164)
    at org.glassfish.json.JsonObjectBuilderImpl.add(JsonObjectBuilderImpl.java:74)
    at com.homer.reports.SummaryReport.getJsonTCObjectBuilder(SummaryReport.java:310)
    at com.homer.reports.SummaryReport.generateJSONReport(SummaryReport.java:255)
    at com.homer.reports.SummaryReport.generateFinalSummaryReport(SummaryReport.java:107)
    at com.homer.setup.RunManager.runTestCases(RunManager.java:130)
    at com.homer.setup.RunManager.runTestCases(RunManager.java:36)
    at com.homer.runner.HomerRunner.main(HomerRunner.java:38)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at ``sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:294)
    at java.lang.Thread.run(Thread.java:745)
java git selenium jenkins selenium-webdriver
1个回答
0
投票

问题 :

您的Jenkins构建试图运行build.xml / pom.xml中配置的自动化测试用例。哪个使用虚拟Json并且在将其解析为所需的pojo时,在Json中发现了一些pojo字段。这触发了这个例外。

修复:在Json / Xml中(可能)缺少的字段顶部的pojo中添加@Nullable注释将解决此问题。

© www.soinside.com 2019 - 2024. All rights reserved.