B4J Question [SOLVED] B4XPages / Java error when loading a Layout

christianjeannot

Member
Licensed User
Hello community,

I am loading a form in B4XMainpage with the following code

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Log("MainPage create")
    
    Root = Root1
    Root.LoadLayout("LayoutMain")
    
    ImprintPage.Initialize
    B4XPages.AddPage("Imprint Page", ImprintPage)
    
End Sub

I get the following error in Debug Mode

Java Error:
Waiting for debugger to connect...
Program started.
MainPage Init
MainPage create
Error occurred on line: 25 (B4XMainPage)
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    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.keywords.Common.CallSubDebug2(Common.java:460)
    at b4j.B4XDicy.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:825)
    at b4j.B4XDicy.b4xpagesmanager._showpage(b4xpagesmanager.java:319)
    at b4j.B4XDicy.b4xpagesmanager._addpage(b4xpagesmanager.java:148)
    at b4j.B4XDicy.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:162)
    at b4j.B4XDicy.b4xpagesmanager._initialize(b4xpagesmanager.java:116)
    at b4j.B4XDicy.main._appstart(main.java:80)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    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.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 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    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:91)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
    at b4j.B4XDicy.main.start(main.java:38)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    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)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:134)
    at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:81)
    ... 35 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    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.debug.Debug.CallSub4(Debug.java:115)
    ... 36 more
Caused by: java.lang.ClassNotFoundException: b4j.B4XDicy.customlistview
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:315)
    at anywheresoftware.b4j.objects.LayoutBuilder.findCustomViewClass(LayoutBuilder.java:238)
    at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:162)
    at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:221)
    at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:101)
    at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:101)
    at anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayout(B4XViewWrapper.java:503)
    at b4j.B4XDicy.b4xmainpage._b4xpage_created(b4xmainpage.java:55)
    ... 41 more

Line 25 is
B4X:
Root.LoadLayout("LayoutMain")

Did I miss something?

Regards

--Christian
 

christianjeannot

Member
Licensed User
Hello Erel,

thank you for your answer.

I had used the Layout files from another project. I guess this was a mishandling by myself.

In this new project I had not add the XUI Views via the Library Manager but in the MainPage Layout was a View from this Library.
I first remove the xCLV. The Debug run was successful. After that I added XUI Views, added the xCLV and now it shows properly.

Best regards

--Christian
 
Upvote 0
Top