UiPath / Community.Activities

Repository of Windows Workflow Foundation Activities for UiPath Community
https://www.uipath.com/community
231 stars 138 forks source link

Java Scope: Error intializing Java : System.NullReferenceException: Object reference not set to an instance of an object. #51

Open wixdonkey opened 4 years ago

wixdonkey commented 4 years ago

Describe the bug

Java Scope: Error intializing Java : System.NullReferenceException: Object reference not set to an instance of an object.

To Reproduce Steps to reproduce the behavior:

  1. Download the java example from https://activities.uipath.com/docs/running-static-and-object-methods
  2. Open the example without any change by UiPath Studio Community Edition.
  3. Press 'Run' button, then raise the error as follow:

    19.7.0+Branch.master.Sha.8c253d13718eed5c7db27daef6facd1fe1b0d067

Source: Java Scope

Message: Error intializing Java : System.NullReferenceException: Object reference not set to an instance of an object. at UiPath.Java.Service.JavaService.b__7_2(IAsyncResult ar) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at UiPath.Java.Service.JavaService.d7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at UiPath.Java.JavaInvoker.d10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at UiPath.Java.Activities.JavaScope.d__12.MoveNext()

Exception Type: System.InvalidOperationException

RemoteException wrapping System.InvalidOperationException: Error intializing Java : System.NullReferenceException: Object reference not set to an instance of an object. at UiPath.Java.Service.JavaService.b__7_2(IAsyncResult ar) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at UiPath.Java.Service.JavaService.d7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at UiPath.Java.JavaInvoker.d10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at UiPath.Java.Activities.JavaScope.d__12.MoveNext() 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)

Expected behavior Could popup the messagebox as the expectation.

Screenshots 1 2

Desktop (please complete the following information):

Additional context Download the example from below: https://activities.uipath.com/docs/running-static-and-object-methods

cosmyo commented 4 years ago

Hi @wixdonkey I will take a look. Meanwhile, have you tried setting Java Library Path in Java Scope to point to java.exe on your computer ?

wixdonkey commented 4 years ago

Hi @cosmyo, Thank for your help in advance!

I already set the Java Library Path. But even if I do nothing but just initialize the java scope, there's always an initial error. The below are some details, hope it will help.

Here is my java home env: image

Here is my scenario:

  1. Only drag the 'Java Scope' to the stage.
  2. Set the 'Java Library Path'. image
  3. Press F5 A moment later the error would be raised. image

From my perspective, I think it's not about the Java Library Path. Since if I don't set the path, Java Libarary will get the path from ENV PATH.

The java scope activity guide wrote: Java Library Path - The path to the Java Library Executable java.exe file. If no path is supplied in this property, the Java Library will be loaded from the PATH environment variable. This field supports only strings and String variables. https://docs.uipath.com/activities/docs/java-scope