B4J Question [jOkHttpUtils2] HttpUtils2Service Error on Wait for

Bladimir Carrillo

Member
Licensed User
Longtime User
Hello,
I am having an error at the second time (the first time runs OK) executing the following code in a timer loop ...

Tick ...:
Sub Tm_Tick
    Dim t As String = "Bearer mytockenxxxxxxxxxx"
    Dim j As HttpJob
    
    j.Initialize("",Me)
    j.Download("http://myapixxxxxxxx")
    j.GetRequest.SetHeader("Authorization",t)
    
    Tm.Enabled = False

    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Log(j.GetString)
    End If
    j.Release
    Tm.Enabled = True
End Sub

The following error occurs at line 11 of Tm_Tick sub (Wait for ...) ...

Error ...:
Error occurred on line: 99 (HttpUtils2Service)
java.io.FileNotFoundException: C:\Users\myUser\AppData\Local\Temp\2 (Access denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:465)
    at b4j.example.httputils2service._hc_responsesuccess(httputils2service.java:138)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
    at anywheresoftware.b4a.BA$3.run(BA.java:267)
    at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:47)
    at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:43)
    at anywheresoftware.b4a.shell.ShellBA.startMessageLoop(ShellBA.java:121)
    at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:180)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:309)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
    at b4j.example.main.main(main.java:29)

Any idea ?
Thank you in advance !
 

aeric

Expert
Licensed User
Longtime User
Try to rename or delete the folder 2

 
Upvote 0

Bladimir Carrillo

Member
Licensed User
Longtime User
Try to rename or delete the folder 2

I understand that is a temporal folder. When stop the program an run again, I can execute it ok at the first time, but at second time I have the same error.
 
Upvote 0

Chris2

Active Member
Licensed User
If it turns out that the temp file is locked and you can't fix the problem directly, have a look at the suggestion from @OliverA in this thread too:
Right now, the solution is to set up a unique temporary folder for each application that uses jOkHttpUtils2. This is accomplished by setting the
HttpUtils2Service.TempFolder .....
 
Upvote 0

Bladimir Carrillo

Member
Licensed User
Longtime User
The problem has been solved manually deleting the temp folder '2', as suggested by aeric and Erel.
I was tesed with debug step by step, then duration of timer is not the problem.
I am not sure if the problem can appear again, I will test the OlierA suggestion if problem appear.

Thank you very much for all your help,
Regards
 
Upvote 0
Top