Getting Error While Invoking Java code into Uipath

Hi All,

We need to Integrate Java code into UiPath for one of the Project and while using the Java Scope Activity getting the below Error message.

Message: Error intializing Java : System.NullReferenceException: Java initialization timeout expired.
at UiPath.Java.Service.JavaService.StartServiceAsync(CancellationToken ct)
at UiPath.Java.JavaInvoker.StartJavaService(Int32 timeout)
at UiPath.Java.Activities.JavaScope.ExecuteAsync(NativeActivityContext context, CancellationToken ct)

Exception Type: System.InvalidOperationException

System.InvalidOperationException: Error intializing Java : System.NullReferenceException: Java initialization timeout expired.
at UiPath.Java.Service.JavaService.StartServiceAsync(CancellationToken ct)
at UiPath.Java.JavaInvoker.StartJavaService(Int32 timeout)
at UiPath.Java.Activities.JavaScope.ExecuteAsync(NativeActivityContext context, CancellationToken ct) at UiPath.Shared.Activities.AsyncTaskNativeImplementation.BookmarkResumptionCallback(NativeActivityContext context, Object value)
at UiPath.Shared.Activities.AsyncTaskNativeActivity.BookmarkResumptionCallback(NativeActivityContext context, Bookmark bookmark, Object value)
at System.Activities.Runtime.BookmarkCallbackWrapper.Invoke(NativeActivityContext context, Bookmark bookmark, Object value)
at System.Activities.Runtime.BookmarkWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Please find the version details and refer the screenshot for error details:
UiPath.Java.Activities.1.3.1
JDK version - C:\Program Files\Java\jdk-22
UiPath Studio Version - 2023.12.0 - Community Edition

Please help us on the solution for the same.

Java Scope Error

Hi @vinoth07
It seems like you’re encountering an issue while trying to integrate Java code into UiPath using the Java Scope activity. The error message indicates a problem with initializing Java, specifically a null reference exception with a timeout expiration.

Here are a few troubleshooting steps you can try:

  1. Check Java Environment: Ensure that your Java Development Kit (JDK) is properly installed and configured on your machine. Double-check the JDK path specified in UiPath settings to ensure it’s pointing to the correct directory.
  2. Verify UiPath Configuration: Confirm that UiPath is configured to use the correct Java version. Check the UiPath settings related to Java integration and ensure they match the JDK version you have installed.
  3. Timeout Settings: The error message mentions a timeout expiration. You might want to increase the timeout duration in the Java Scope activity settings to allow more time for Java initialization, especially if your Java environment takes longer to initialize.
  4. Restart UiPath: Sometimes, restarting UiPath Studio or the machine itself can resolve issues related to Java integration.
  5. Update UiPath and Java Activities: Ensure that you’re using the latest version of UiPath Studio and the Java activities package. Sometimes, updating to the latest versions can resolve compatibility issues and bugs.
  6. Check System Resources: Insufficient system resources can also cause initialization timeouts. Make sure your machine has enough memory and processing power to run both UiPath and Java smoothly.

If none of the above steps resolve the issue, you might need to delve deeper into the specific configurations and environment setup to identify the root cause. Additionally, consulting UiPath forums or reaching out to UiPath support can provide further assistance and insights.

I have verified the environment variable and checked all the above mentioned details and looks fine. but still facing the same below timeout issue.

Source: Java Scope

Message: Error intializing Java : System.NullReferenceException: Java initialization timeout expired.
at UiPath.Java.Service.JavaService.StartServiceAsync(CancellationToken ct)
at UiPath.Java.JavaInvoker.StartJavaService(Int32 timeout)
at UiPath.Java.Activities.JavaScope.ExecuteAsync(NativeActivityContext context, CancellationToken ct)

Exception Type: System.InvalidOperationException

System.InvalidOperationException: Error intializing Java : System.NullReferenceException: Java initialization timeout expired.
at UiPath.Java.Service.JavaService.StartServiceAsync(CancellationToken ct)
at UiPath.Java.JavaInvoker.StartJavaService(Int32 timeout)
at UiPath.Java.Activities.JavaScope.ExecuteAsync(NativeActivityContext context, CancellationToken ct) at UiPath.Shared.Activities.AsyncTaskNativeImplementation.BookmarkResumptionCallback(NativeActivityContext context, Object value)
at UiPath.Shared.Activities.AsyncTaskNativeActivity.BookmarkResumptionCallback(NativeActivityContext context, Bookmark bookmark, Object value)
at System.Activities.Runtime.BookmarkCallbackWrapper.Invoke(NativeActivityContext context, Bookmark bookmark, Object value)
at System.Activities.Runtime.BookmarkWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Any one faced similar kind of issue and any other settings need to be done from UiPath end?