powered by Jive Software

Openfire server error while sending OMEMO messages (Openfire version : 4.2.3, SMACK version: 4.2.4, OMEMO-Signal:4.2.4-SNAPSHOT)

I am getting the following server error while trying to send a message:
org.jivesoftware.openfire.handler.IQHandler - Internal server error
java.lang.NullPointerException
at org.jivesoftware.openfire.pep.IQPEPHandler.hasInfo(IQPEPHandler.java:715)
at org.jivesoftware.openfire.disco.IQDiscoInfoHandler$1.hasInfo(IQDiscoInfoHandler.java:482)
at org.jivesoftware.openfire.disco.IQDiscoInfoHandler.handleIQ(IQDiscoInfoHandler.java:123)
at org.jivesoftware.openfire.handler.IQHandler.process(IQHandler.java:62)
at org.jivesoftware.openfire.IQRouter.handle(IQRouter.java:369)
at org.jivesoftware.openfire.IQRouter.route(IQRouter.java:112)
at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:74)
at org.jivesoftware.openfire.net.StanzaHandler.processIQ(StanzaHandler.java:348)
at org.jivesoftware.openfire.net.ClientStanzaHandler.processIQ(ClientStanzaHandler.java:95)
at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:314)
at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:201)
at org.jivesoftware.openfire.nio.ConnectionHandler.messageReceived(ConnectionHandler.java:177)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:690)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765)
at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765)
at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:407)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:236)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765)
at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:74)
at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63)
at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTask(OrderedThreadPoolExecutor.java:769)
at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTasks(OrderedThreadPoolExecutor.java:761)
at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.run(OrderedThreadPoolExecutor.java:703)
at java.lang.Thread.run(Thread.java:748)

The following code is used to for OMEMO setup:
SignalOmemoService.acknowledgeLicense();
SignalOmemoService.setup();
OmemoConfiguration.setFileBasedOmemoStoreDefaultPath(ConnectionManager.keysFile);
omemoManager = OmemoManager.getInstanceFor(XMPPUtil.getXmppConnection());
omemoManager.initialize();

Devices are trusted using :
omemoManager.trustOmemoIdentity(device, fingerPrints.get(device));

and finally the message is sent as :
msg = OmemoManager.getInstanceFor(XMPPUtil.getXmppConnection()).encrypt(entry.getJid().asEntityBareJidIfPossible(), message);
ChatManager.getInstanceFor(XMPPUtil.getXmppConnection()).chatWith(entry.getJid().asEntityBareJidIfPossible()).send(msg);

the encrypted message contains the body:

I sent you an OMEMO encrypted message but your client doesn’t seem to support that. Find more information on https://conversations.im/omemo

Please note that the client is an android application and uses SMACK version 4.2.4 and OMEMO signal version 4.2.4-SNAPSHOT.

Thanks for your help in advance.

If you restart your Openfire server it will work. The reason for this is IQPEPHandler.hasInfo method where this method is getting PEPService from cache:

PEPService pepService = pepServiceManager.getPEPService(recipientJID);

So it returns null for pepService, and it tries to load it from memory and not from DB. I will try to find fix for this error. I do not know if it has relation with this:

https://issues.igniterealtime.org/browse/OF-1427