Power BI Refresh Error:
Fabric Copy Activity Error 20002
What does this error mean?
The on-premises data gateway failed to invoke the Java Native Interface (JNI), typically because illegal or oversized JVM arguments are set in the system environment, preventing JVM creation. This causes copy activities requiring Java (Parquet, ORC) to fail.
Common causes
- 1The _JAVA_OPTIONS system environment variable contains invalid arguments or a maximum heap size (-Xmx) that exceeds the available physical memory on the gateway machine
- 2Conflicting JVM options set across multiple environment variables (e.g., _JAVA_OPTIONS, JAVA_TOOL_OPTIONS, JDK_JAVA_OPTIONS) that together produce illegal argument combinations
- 3A previous administrator set global JVM flags for a different application that are incompatible with the gateway's JVM requirements
- 4The gateway was not restarted after changes to JVM-related environment variables, so the old invalid configuration is still active
How to fix it
- 1Step 1: Log in to each node of the on-premises data gateway cluster and open System Properties → Advanced → Environment Variables.
- 2Step 2: Locate the _JAVA_OPTIONS system variable (and any related variables such as JAVA_TOOL_OPTIONS) and review the values for illegal flags or heap size settings larger than the machine's available RAM.
- 3Step 3: Set _JAVA_OPTIONS to a safe value such as '-Xms256m -Xmx8g' (or up to -Xmx16g if the machine has sufficient RAM); remove any unknown or application-specific flags that were not intentionally set for the gateway.
- 4Step 4: Save the changes and restart the on-premises data gateway service on every node in the cluster.
- 5Step 5: Rerun the pipeline and verify the copy activity completes; if the error persists, temporarily clear _JAVA_OPTIONS entirely to isolate whether the variable is the root cause.