> For the complete documentation index, see [llms.txt](https://docs.sealights.io/knowledgebase/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sealights.io/knowledgebase/setup-and-configuration/troubleshooting-faq/java/java-module-access-error.md).

# Java Module Access Error

## Problem <a href="#problem" id="problem"></a>

JVM return an error like

{% code overflow="wrap" lineNumbers="true" %}

```
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError
accessible: module java.base does not "opens java.lang" to unnamed module @1d7acb34
```

{% endcode %}

## Cause <a href="#cause" id="cause"></a>

The issue at hand is caused by newer versions of Java restricting access to certain libraries. We can see that issues are occurring as SeaLights added support to Java 17.

## Solution <a href="#solution" id="solution"></a>

Adding the option `--add-opens java.base/java.lang=ALL-UNNAMED` to the `Maven Surefire plugin` and `Maven Failsafe plugin` configuration prevents exceptions like that.

Example for the `Maven Surefire plugin`

{% code overflow="wrap" lineNumbers="true" %}

```
"surefireArgLine": "-Xms1280m -Xmx1280m @{sealightsArgLine} ${surefireArgLine} --add-opens java.base/java.lang=ALL-UNNAMED"
```

{% endcode %}

Example for the `Maven Failsafe plugin`

{% code overflow="wrap" lineNumbers="true" %}

```
"failsafeArgLine": "-Xmx8192m @{sealightsArgLine} -Dsl.testStage=\"Integration Tests\" --add-opens java.base/java.lang=ALL-UNNAMED"
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sealights.io/knowledgebase/setup-and-configuration/troubleshooting-faq/java/java-module-access-error.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
