B4J Question OkHttpUtils2 on non-ui

Discussion in 'B4J Questions' started by BarryW, Feb 20, 2019.

  1. BarryW

    BarryW Active Member Licensed User

    Code:
    Waiting for debugger to connect...
    Program started.
    Error occurred on line: 
    56 (HttpUtils2Service)
    java.io.FileNotFoundException: C:\Users\ADMINI~
    1\AppData\Local\Temp\1 (Access is 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:439)
        at b4j.example.httputils2service._hc_responsesuccess(httputils2service.java:
    106)
        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:632)
        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:
    91)
        at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:
    98)
        at anywheresoftware.b4a.BA$
    3.run(BA.java:247)
        at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:
    30)
        at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:
    26)
        at anywheresoftware.b4a.shell.ShellBA.startMessageLoop(ShellBA.java:
    119)
        at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:
    153)
        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:
    91)
        at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:
    98)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:
    78)
        at b4j.example.main.main(main.java:
    29)
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    This is not the correct way to post a question. Where is the relevant code?
     
  3. BarryW

    BarryW Active Member Licensed User

    Code:
    Dim job As HttpJob
        job.Initialize(
    "send", Me)
        job.PostString(
    "http://mylink.com/test""") <-- Error in here
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Seems like a permission problem. The process is not able to access the temporary folder.

    You can set it to a different folder with:
    Code:
    HttpUtils2Service.Service_Create
    HttpUtils2Service.TempFolder = 
    File.DirApp
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice