marcel Active Member Licensed User Longtime User May 7, 2016 #1 Hi, I am fire a number of post (3) to the server and the first 2 get a postive result in the job_done but the last one get a java error: Code: 1462615841326: Posted data 1462615841335: Push:2 1462615842011: Posted data ** Service (locationservice) Start ** Start Service ** Service (httputils2service) Create ** ** Service (httputils2service) Start ** ** Service (httputils2service) Start ** ** Service (httputils2service) Start ** ** Service (httputils2service) Start ** 1462615842471: JobName = PostSPData, Success = true, Err = 1462615842475: Posted Return ->201 1462615842491: JobName = PostSPData, Success = true, Err = 1462615842494: Posted Return ->201 Error occurred on line: 168 (HttpJob) java.io.FileNotFoundException: /data/data/com.cyclonesoftware/cache/1: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:456) at java.io.FileInputStream.<init>(FileInputStream.java:76) at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:209) at com.cyclonesoftware.httpjob._getstring2(httpjob.java:338) at com.cyclonesoftware.httpjob._getstring(httpjob.java:78) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134) at anywheresoftware.b4a.BA$2.run(BA.java:328) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5832) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) at libcore.io.Posix.open(Native Method) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186) at libcore.io.IoBridge.open(IoBridge.java:442) ... 21 more I have modified the HttpUtils2Service to receive the status code: Code: Sub hc_ResponseSuccess (Response As OkHttpResponse, TaskId As Int) Dim job As HttpJob = TaskIdToJob.Get(TaskId) job.Tag = Response.StatusCode Response.GetAsynchronously("response", File.OpenOutput(TempFolder, TaskId, False), _ True, TaskId) End Sub This is my posting code (the param is just a JSON string) Code: job.PostString(URLPost,param) job.GetRequest.SetContentType("application/json") job.GetRequest.Timeout = 60000 This is part of my job_done code: Code: Helpers.NLog("Posted Return ->" & job.Tag) If job.Tag=201 Then Dim res As String = job.GetString db.ExecNonQuery2("update Reports Set SendedToBase=1 where id=?", Array As Int(res)) Helpers.LastReportSent(db) End If As I said the first post 2 post of the 3 works well and the last failed with the above java error. Any one an Idea where to look? it looks like a file is deleted that shouldn't be deleted
Hi, I am fire a number of post (3) to the server and the first 2 get a postive result in the job_done but the last one get a java error: Code: 1462615841326: Posted data 1462615841335: Push:2 1462615842011: Posted data ** Service (locationservice) Start ** Start Service ** Service (httputils2service) Create ** ** Service (httputils2service) Start ** ** Service (httputils2service) Start ** ** Service (httputils2service) Start ** ** Service (httputils2service) Start ** 1462615842471: JobName = PostSPData, Success = true, Err = 1462615842475: Posted Return ->201 1462615842491: JobName = PostSPData, Success = true, Err = 1462615842494: Posted Return ->201 Error occurred on line: 168 (HttpJob) java.io.FileNotFoundException: /data/data/com.cyclonesoftware/cache/1: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:456) at java.io.FileInputStream.<init>(FileInputStream.java:76) at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:209) at com.cyclonesoftware.httpjob._getstring2(httpjob.java:338) at com.cyclonesoftware.httpjob._getstring(httpjob.java:78) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134) at anywheresoftware.b4a.BA$2.run(BA.java:328) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5832) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) at libcore.io.Posix.open(Native Method) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186) at libcore.io.IoBridge.open(IoBridge.java:442) ... 21 more I have modified the HttpUtils2Service to receive the status code: Code: Sub hc_ResponseSuccess (Response As OkHttpResponse, TaskId As Int) Dim job As HttpJob = TaskIdToJob.Get(TaskId) job.Tag = Response.StatusCode Response.GetAsynchronously("response", File.OpenOutput(TempFolder, TaskId, False), _ True, TaskId) End Sub This is my posting code (the param is just a JSON string) Code: job.PostString(URLPost,param) job.GetRequest.SetContentType("application/json") job.GetRequest.Timeout = 60000 This is part of my job_done code: Code: Helpers.NLog("Posted Return ->" & job.Tag) If job.Tag=201 Then Dim res As String = job.GetString db.ExecNonQuery2("update Reports Set SendedToBase=1 where id=?", Array As Int(res)) Helpers.LastReportSent(db) End If As I said the first post 2 post of the 3 works well and the last failed with the above java error. Any one an Idea where to look? it looks like a file is deleted that shouldn't be deleted
fixit30 Active Member Licensed User Longtime User May 7, 2016 #2 You need to make sure that the Task Id for each request is unique. Upvote 0
marcel Active Member Licensed User Longtime User May 7, 2016 #3 Yes, But this is handler by the library. Not something I can influence. Upvote 0
DonManfred Expert Licensed User Longtime User May 7, 2016 #4 You need to show more code. Did you dim a new job each time you send one? Did you release the job in jobdone? Upvote 0
You need to show more code. Did you dim a new job each time you send one? Did you release the job in jobdone?
marcel Active Member Licensed User Longtime User May 7, 2016 #5 DonManfred said: You need to show more code. Did you dim a new job each time you send one? Did you release the job in jobdone? Click to expand... 1) No, is that needed? 2) Yes Upvote 0
DonManfred said: You need to show more code. Did you dim a new job each time you send one? Did you release the job in jobdone? Click to expand... 1) No, is that needed? 2) Yes
DonManfred Expert Licensed User Longtime User May 7, 2016 #6 marcel said: 1) No, is that needed? Click to expand... Yes. This is where you create a new taskid. Just place the dim of your job like this. Don´t use global variables. marcel said: dim job As HttpJob ' init your job and so on. But do this each time you want to send a new job (including the leading DIM) job.PostString(URLPost,param) Click to expand... Upvote 0
marcel said: 1) No, is that needed? Click to expand... Yes. This is where you create a new taskid. Just place the dim of your job like this. Don´t use global variables. marcel said: dim job As HttpJob ' init your job and so on. But do this each time you want to send a new job (including the leading DIM) job.PostString(URLPost,param) Click to expand...
marcel Active Member Licensed User Longtime User May 7, 2016 #7 marcel said: 1) No, is that needed? 2) Yes Click to expand... 1) That seems to work. I dim it now every time. Thanks! Upvote 0
marcel said: 1) No, is that needed? 2) Yes Click to expand... 1) That seems to work. I dim it now every time. Thanks!