B4J Question B4j-Bridge fails to debug application.

Dominik H

Member
Licensed User
Longtime User
I am receiving an error when using B4J-Bridge on either of my PC's, first when I add the IP it says "Ping failed" but I add it anyway and it shows that the devices connected. But when I try to debug the program I get this error, on the second machine I do however find that files were transferred over and are now in the recycling bin.

B4X:
Program started.
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.DynamicBuilder.build(DynamicBuilder.java:16)
    at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:113)
    at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:154)
    at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:77)
    at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:76)
    at b4j.example.main._appstart(main.java:264)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:593)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:228)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at b4j.example.main.start(main.java:36)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Metho
d)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(Unknown Source)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$148(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Asset file not found: Rank.png
    at anywheresoftware.b4a.objects.streams.File.GetUri(File.java:158)
    at anywheresoftware.b4j.objects.NodeWrapper.getImageUri(NodeWrapper.java:616)
    at anywheresoftware.b4j.objects.NodeWrapper.buildDrawable(NodeWrapper.java:554)
    at anywheresoftware.b4j.objects.NodeWrapper.build(NodeWrapper.java:405)
    at anywheresoftware.b4j.objects.ImageViewWrapper.build(ImageViewWrapper.java:103)
    ... 34 more
Error occurred on line: 146 (Main)
java.lang.RuntimeException: Object should first be initialized (ImageView).
    at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:32)
    at anywheresoftware.b4j.objects.NodeWrapper.innerInitialize(NodeWrapper.java:79)
    at anywheresoftware.b4j.objects.ImageViewWrapper.innerInitialize(ImageViewWrapper.java:39)
    at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:136)
    at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:154)
    at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:77)
    at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:76)
    at b4j.example.main._appstart(main.java:264)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.ja
va:593)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:228)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at b4j.example.main.start(main.java:36)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(Unknown Source)
    at com.sun.glass.ui.In
vokeLaterDispatcher$Future.run(Unknown Source)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$148(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

I have Java 8u72 on both machines. What is the cause of this?

PS: Next time would you be so kind and let me know that I am posting in the wrong part of the forums, because if I hadn't made a backup of this, I'd be writing things from scratch again...
 

Dominik H

Member
Licensed User
Longtime User
Have you added Rank.png to the Files tab?
Yes I have, and it works fine on my own machine so I don't see why it wouldnt work over the bridge.
I readded the Rank.png, and now I don't get any errors, however; The error when trying to connect the devices still exists:
b55100101c.png


On my second PC it will say "Connected!" as soon as I click yes on the dialog above.

When I try to debug my program, the second pc will say "Start program" followed by "ProcessCompleted" and nothing ever happens. I do get a tempjars folder on my desktop though.
 
Last edited:
Upvote 0

Dominik H

Member
Licensed User
Longtime User
The ping fails for some reason. You can ignore it.

What happens in the IDE when you run the app with B4J-Bridge connected? Do you see the logs?
Well, I've tested it again today and it comes up with the missing Rank.png asset, so what I've done is: I've set one of my images on the designer from "Rank.png" to nothing, and then set it back to Rank.png and it suddenly works...

Any reason for that?
 
Upvote 0

Dominik H

Member
Licensed User
Longtime User
Make sure to always first add the files to the Files tab (in the designer or in the main code editor).
I did, the item was clearly listed in the files tab and designer. So I really don't know what it could've been.

Anyway, thanks for pointing it out - it's all sorted out now.
 
Upvote 0
Top