当前位置: 首页 > 知识库问答 >
问题:

InAccessibleObjectException:

墨翔宇
2023-03-14

我将selenium与testng和Maven一起使用。原因是:java.lang.runtimeException:java.lang.reflect.InaccessibleObjectException:无法使本机jdk.internal.reflect.ConstantPool java.lang.class.GetConstantPool()可访问:模块java.base不“打开java.lang”到未命名模块@4387b79e.at runner.testrunner.feature(Testrunner.java:47)。如果需要更多的细节,请给我打电话。我不能开始这个项目。前面它给出了我添加的未找到的异常类,

无法使本机jdk.internal.reflect.constantpool java.lang.class.getConstantpool()可访问:模块java.base不对未命名模块@4387b79e“打开java.lang”

    <dependency>
        <groupId>xerces</groupId>
        <artifactId>xerces</artifactId>
        <version>2.4.0</version>
    </dependency>
    <dependency>
        <groupId>xerces</groupId>
        <artifactId>xercesImpl</artifactId>
        <version>2.11.0</version>
    </dependency>

共有1个答案

公孙志尚
2023-03-14
Now it is giving the folloing error

[ERROR] Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 62.064 s <<< FAILURE! - in TestSuite
[ERROR] feature(Runner.TestRunner)  Time elapsed: 52.413 s  <<< FAILURE!
java.lang.ExceptionInInitializerError
    at Runner.TestRunner.feature(TestRunner.java:47)
Caused by: java.lang.RuntimeException: java.lang.reflect.InaccessibleObjectException: Unable to make native jdk.internal.reflect.ConstantPool java.lang.Class.getConstantPool() accessible: module java.base does not "opens java.lang" to unnamed module @4387b79e
    at Runner.TestRunner.feature(TestRunner.java:47)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make native jdk.internal.reflect.ConstantPool java.lang.Class.getConstantPool() accessible: module **java.base does not "opens java.lang" to unnamed module @4387b79e
    at Runner.TestRunner.feature(TestRunner.java:47)**

[ERROR] tearDownClass(Runner.TestRunner)  Time elapsed: 52.536 s  <<< FAILURE!
java.lang.NullPointerException: Cannot invoke "com.aventstack.extentreports.ExtentTest.assignAuthor(String[])" because the return value of "com.cucumber.listener.Reporter.getCurrentScenario()" is null
    at Runner.TestRunner.tearDownClass(TestRunner.java:58)

************************************************************************

If I try the below dependency instead of xereces dependency as below
    <dependency> 
      <groupId>xml-apis</groupId>
      <artifactId>xml-apis</artifactId>
      <version>1.4.01</version>
    </dependency>

I am getting the following error


[ERROR] tearDownClass(Runner.TestRunner)  Time elapsed: 19.433 s  <<< FAILURE!
**java.lang.NoClassDefFoundError: org/w3c/dom/ls/DocumentLS**
    at Runner.TestRunner.tearDownClass(TestRunner.java:57)
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ls.DocumentLS
    at Runner.TestRunner.tearDownClass(TestRunner.java:57)
 类似资料:

相关问答

相关文章

相关阅读