Dear friends,
Can we have a broker service for MQTT started as a sticky service? If possible how to do it? I tried with no layout app and the app crashed displaying a log as follows:
Can we have a broker service for MQTT started as a sticky service? If possible how to do it? I tried with no layout app and the app crashed displaying a log as follows:
B4X:
** Service (starter) Create **
starter_service_create (java line: 145)
io.netty.channel.ChannelException: Unable to create Channel from class class io.netty.channel.socket.nio.NioServerSocketChannel
at io.netty.bootstrap.AbstractBootstrap$BootstrapChannelFactory.newChannel(AbstractBootstrap.java:457)
at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:308)
at io.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:273)
at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:269)
at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:251)
at org.eclipse.moquette.server.netty.NettyAcceptor.initFactory(NettyAcceptor.java:142)
at org.eclipse.moquette.server.netty.NettyAcceptor.initializePlainTCPTransport(NettyAcceptor.java:155)
at org.eclipse.moquette.server.netty.NettyAcceptor.initialize(NettyAcceptor.java:105)
at org.eclipse.moquette.server.Server.startServer(Server.java:96)
at anywheresoftware.b4j.objects.MqttBroker.Start(MqttBroker.java:72)
at b4a.example.starter._service_create(starter.java:145)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at b4a.example.starter.onCreate(starter.java:54)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2877)
at android.app.ActivityThread.-wrap4(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1427)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: io.netty.channel.ChannelException: Failed to open a server socket.
at io.netty.channel.socket.nio.NioServerSocketChannel.newSocket(NioServerSocketChannel.java:59)
at io.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:70)
at java.lang.Class.newInstance(Native Method)
at io.netty.bootstrap.AbstractBootstrap$BootstrapChannelFactory.newChannel(AbstractBootstrap.java:455)
... 23 more
Caused by: java.net.SocketException: socket failed: EACCES (Permission denied)
at libcore.io.IoBridge.socket(IoBridge.java:619)
at java.net.PlainSocketImpl.create(PlainSocketImpl.java:198)
at java.net.PlainServerSocketImpl.create(PlainServerSocketImpl.java:38)
at java.net.ServerSocket.<init>(ServerSocket.java:64)
at java.nio.ServerSocketChannelImpl$ServerSocketAdapter.<init>(ServerSocketChannelImpl.java:120)
at java.nio.ServerSocketChannelImpl.<init>(ServerSocketChannelImpl.java:51)
at java.nio.SelectorProviderImpl.openServerSocketChannel(SelectorProviderImpl.java:45)
at io.netty.channel.socket.nio.NioServerSocketChannel.newSocket(NioServerSocketChannel.java:57)
... 26 more
Caused by: android.system.ErrnoException: socket failed: EACCES (Permission denied)
at libcore.io.Posix.socket(Native Method)
at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:282)
at libcore.io.IoBridge.socket(IoBridge.java:604)
... 33 more