B4J Question Raspberry module CM4 and jP4iJ

micro

Well-Known Member
Licensed User
Longtime User
Hi to all
As many already know the jP4iJ library does not work with the new CM4 modules from raspebrry, does anyone have any news about this?
I hope there is some update of the new library.
Have a nice day everyone

Error:
GRAVE: Unable to load [libpi4j.so] using path: [/lib/raspberrypi/static/libpi4j.so]
 
Last edited:

micro

Well-Known Member
Licensed User
Longtime User
Latest Updates
I had mistakenly chosen the old library but even with the new one wrapped by Erel it still doesn't work
Example:
Sub Class_Globals
    Private fx As JFX
    Public IsInitialized As Boolean
    Private pi4j As Pi4J
    Public Valvola As DigitalOutput    'true Open valvola
End Sub

Public Sub Initialize(Inverti As Boolean)
    Try
        If IsInitialized Then Return
        pi4j.Initialize("pi4j")
        Valvola.Initialize(pi4j, 16)  '<-- Error
        Valvola.State = False
    Catch As Exception
        Log(LastException.Message)
    End Try
End Sub

Waiting for debugger to connect...

Program started.

log4j:WARN No appenders could be found for logger (com.pi4j.Pi4J).

log4j:WARN Please initialize the log4j system properly.

log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

~e:

Error occurred on line: 43 (RaspIO_19R)

java.lang.reflect.UndeclaredThrowableException

at com.sun.proxy.$Proxy3.create(Unknown Source)

at com.pi4j.context.Context.create(Context.java:317)

at com.pi4j.internal.IOCreator.create(IOCreator.java:58)

at com.pi4j.internal.IOCreator.create(IOCreator.java:96)

at com.pi4j.internal.IOCreator.create(IOCreator.java:176)

at anywheresoftware.b4j.objects.Pi4JWrapper$DigitalOutputWrapper.Initialize(Pi4JWrapper.java:79)

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.runVoidMethod(Shell.java:673)

at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:240)

at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)

at java.base/jdk.internal.reflect.NativeMetho

dAccessorImpl.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:111)

at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)

at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:64)

at b4j.riempilattineComPi.raspio_19r._initialize(raspio_19r.java:671)

at b4j.riempilattineComPi.main._initobject(main.java:1480)

at b4j.riempilattineComPi.main$ResumableSub_AppStart.resume(main.java:1078)

at b4j.riempilattineComPi.main._appstart(main.java:1028)

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(Delegating

MethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:566)

at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)

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:111)

at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)

at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)

at b4j.riempilattineComPi.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:456)

at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:429)

at java.base/java.security.AccessController.doPrivileged(Native Method)

at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:428)

at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)

at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)

at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)

at java.base/java.lang.Thread.run(Thread.java:829)

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 com.pi4j.provider.impl.ProviderProxyHandler.invoke(ProviderProxyHandler.java:100)

... 48 more

Caused by: com.pi4j.library.pigpio.PiGpioException: PIGPIO ERROR: PI_INIT_FAILED; pigpio initialisation failed

at com.pi4j.library.pigpio.impl.PiGpioBase.validateResult(PiGpioBase.java:263)

at com.pi4j.library.pigpio.impl.PiGpioBase.validateResult(PiGpioBase.java:249)

at com.pi4j.library.pigpio.impl.PiGpioNativeImpl.gpioInitialise(PiGpioNativeImpl.java:95)

at com.pi4j.library.pigpio.PiGpio.initialize(PiGpio.java:146)

at com.pi4j.plugin.pigpio.provider.gpio.digital.PiGpioDigitalOutputProviderImpl.create(PiGpioDigitalOutputProviderImpl.java:60)

at com.pi4j.plugin.pigpio.provider.gpio.digital.PiGpioDigitalOutputProviderImpl.create(PiGpioDigitalOutputProviderImpl.java:41)
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
Pi4J2 should be compatible with CM4. Are you running b4j-bridge with sudo?
Sure Erel
it is a routine now to debug the raspebrry and I have a ready script that I have been using for years.
Thanks
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
Strange
I also installed pi4j v2 on CM4 raspberry but the error is still the same.
Has anyone tried on CM4 with Bullseye OS?
This the reference lib on the CM4
1687843645648.png

Thanks
 
Upvote 0
Top