E EvgenyB4A Active Member Licensed User Longtime User Jan 30, 2023 #1 Hi, I have 10 instances of b4J app that periodically make HTTP Post to external server. Sometimes one or some instances fall with following error: httputils2service._hc_responsesuccess (java line: -1) java.io.FileNotFoundException: C:\Users\evgeny\AppData\Local\Temp\39 (The process cannot access the file because it is being used by another process) at java.base/java.io.FileOutputStream.open0(Native Method) at java.base/java.io.FileOutputStream.open(Unknown Source) at java.base/java.io.FileOutputStream.<init>(Unknown Source) at b4j/anywheresoftware.b4a.objects.streams.File.OpenOutput(Unknown Source) at b4j/b4j.example.httputils2service._hc_responsesuccess(Unknown Source) at jdk.internal.reflect.GeneratedMethodAccessor9.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source) at b4j/anywheresoftware.b4a.BA$3.run(Unknown Source) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) How to solve this problem?
Hi, I have 10 instances of b4J app that periodically make HTTP Post to external server. Sometimes one or some instances fall with following error: httputils2service._hc_responsesuccess (java line: -1) java.io.FileNotFoundException: C:\Users\evgeny\AppData\Local\Temp\39 (The process cannot access the file because it is being used by another process) at java.base/java.io.FileOutputStream.open0(Native Method) at java.base/java.io.FileOutputStream.open(Unknown Source) at java.base/java.io.FileOutputStream.<init>(Unknown Source) at b4j/anywheresoftware.b4a.objects.streams.File.OpenOutput(Unknown Source) at b4j/b4j.example.httputils2service._hc_responsesuccess(Unknown Source) at jdk.internal.reflect.GeneratedMethodAccessor9.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source) at b4j/anywheresoftware.b4a.BA$3.run(Unknown Source) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) How to solve this problem?
Erel B4X founder Staff member Licensed User Longtime User Jan 30, 2023 #2 Add this at the beginning: Code: Copy xui.SetDataFolder("YourApp") HttpUtils2Service.Service_Create Dim Folder As Int = Rnd(1, 1000000) File.MakeDir(xui.DefaultFolder, Folder) HttpUtils2Service.TempFolder = File.Combine(xui.DefaultFolder, Folder) Upvote 0
Add this at the beginning: Code: Copy xui.SetDataFolder("YourApp") HttpUtils2Service.Service_Create Dim Folder As Int = Rnd(1, 1000000) File.MakeDir(xui.DefaultFolder, Folder) HttpUtils2Service.TempFolder = File.Combine(xui.DefaultFolder, Folder)