powered by Jive Software

Openfire pubsub with oracle after restart - cannot access previous nodes

hi all,

I am a new user to openfire. I am using the pubsub support of openfire with backend connected to oracle db. For the front end I am using smack library pubsub extension as welll as jabberwerx.

The initial setup worked fine and I was able to create nodes and publish with no issues. After sometime I had to restart the openfire server and now if I try to access the nodes I created earlier, it gives me a null pointer exception for the getNode request.

The same scenario works fine with any number of openfire restarts using the embedded hsql db.

I am pasting the exception from the smack client and the same exception is also in the openfire debug logs. Any help is greately appreciated.

2009.11.13 14:52:58 [org.jivesoftware.openfire.pubsub.PubSubModule.process(PubSubModule.java:189)] Internal server error
java.lang.NullPointerException
at org.xmpp.forms.DataForm.encode(DataForm.java:98)
at org.xmpp.forms.FormField.addValue(FormField.java:39)
at org.jivesoftware.openfire.pubsub.Node.addFormFields(Node.java:823)
at org.jivesoftware.openfire.pubsub.LeafNode.addFormFields(LeafNode.java:120)
at org.jivesoftware.openfire.pubsub.Node.getMetadataForm(Node.java:1050)
at org.jivesoftware.openfire.pubsub.PubSubModule.getExtendedInfo(PubSubModule.java :663)
at org.jivesoftware.openfire.disco.IQDiscoInfoHandler.handleIQ(IQDiscoInfoHandler. java:164)
at org.jivesoftware.openfire.pubsub.PubSubModule.process(PubSubModule.java:213)
at org.jivesoftware.openfire.pubsub.PubSubModule.process(PubSubModule.java:178)
at org.jivesoftware.openfire.spi.RoutingTableImpl.routePacket(RoutingTableImpl.jav a:260)
at org.jivesoftware.openfire.IQRouter.handle(IQRouter.java:303)
at org.jivesoftware.openfire.IQRouter.route(IQRouter.java:101)
at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:68)
at org.jivesoftware.openfire.net.StanzaHandler.processIQ(StanzaHandler.java:319)
at org.jivesoftware.openfire.net.ClientStanzaHandler.processIQ(ClientStanzaHandler .java:79)
at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:284)
at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:176)
at org.jivesoftware.openfire.nio.ConnectionHandler.messageReceived(ConnectionHandl er.java:133)
at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived (AbstractIoFilterChain.java:570)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(Ab stractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilt erChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceive d(AbstractIoFilterChain.java:648)
at org.apache.mina.common.IoFilterAdapter.messageReceived(IoFilterAdapter.java:80)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(Ab stractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilt erChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceive d(AbstractIoFilterChain.java:648)
at org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimplePr otocolDecoderOutput.java:58)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecF ilter.java:185)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(Ab stractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilt erChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceive d(AbstractIoFilterChain.java:648)
at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java :239)
at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(Execut orFilter.java:283)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.lang.Thread.run(Unknown Source)

I ran into the same issue some time ago, and when I went to fix it I found that it is already fixed in Trunk. Basically, there is a difference in how Oracle and HSQL store null string values. So the get on the string fields like node description return a null, which is causing the exception you are seeing. I believe HSQL is returning an empty string instead, which is why it works. The newer version of the DataForm code handles the null appropriately so the exception no longer occurs.

Basically you have 3 options.

  1. Download and use trunk (it has a lot of other fixes as well for pubsub specifically).
  2. Use HSQL instead of Oracle.
  3. Make sure you populate all your node metadata fields with empty strings instead of null.

Thanks for the pointer. Ended up downloading the linux source version of openfire 3.6.4 and add a null check to the DatForm.java encode method.That solved the issue.

Note: The windows source version 3.6.4 doesn’t seem to compatible to the binary 3.6.4.

Can I provide the fix as a patch?

Is there any place to provide openfire patches

You can include them here as .patch files. But as was pointed out this issue is already fixed in the source code so I am not sure if your patch will ever get used. I know I have used pubsub with Oracle without issue with the existing source.

There is only 1 source. Only the installs differ for different platforms.