B4J Question HttpUtils2service: B4j Server Crash

Mashiane

Expert
Licensed User
Longtime User
Hi there

From time to time our server crashes with this error.

B4X:
httputils2service._hc_responsesuccess (java line: 98)
java.io.FileNotFoundException: C:\Users\ADMINI~1\AppData\Local\Temp\2\1032 (Access is denied)
    at java.base/java.io.FileOutputStream.open0(Native Method)
    at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
    at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
    at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:465)
    at b4j.example.httputils2service._hc_responsesuccess(httputils2service.java:98)
    at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:109)
    at anywheresoftware.b4a.BA$3.run(BA.java:265)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:834)

How can I solve this issue once and for all?

At the moment I just start my app again and everything goes back to normal.

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
For B4J one should use jokhttputils2 Library, right.

Or maybe the server version of it.
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
You haven't provided enough information.

Hi there

Please find attached my project. Its using Public server As ServerSocket

I have tried to implement the recommendations, however its saying it does not have createthreadsafemap or something.

Perhaps this could highlight what should be done differently. Please note this is legacy code that has been used and thus if there is a new way of doing this it could help a great deal.

Thanks in advance.

PS: All in all this just receives a string, parses it and executes other functions. Everything would work well and at times, the error reports on the original questions pops up.

Another thing. I have just noted that 3 of these apps have the same package name e.g b4j.example, could that be another cause?
 

Attachments

  • AVPSigfoxBroker.zip
    5.1 KB · Views: 99
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
1. B4J server usually means a real server built with jServer.
Let me do a comparison of my code with what is in this post and I will see what I can do differently as 80% if it apparently was the source:

2. Sub JobDone = bad practice
Noted and will trace if used and will be fixed.

The error message from the first post can never happen with the code you posted.
Baffling indeed because the first post error comes from the app attached. It stops and I have to restart it each time.

Thanks you so much.
 
Upvote 0
Top