Open fire pubsubscribe: Subscribe from another user throws item-not-found(404)

Scenario:

User A create a node music with publish model and access model open.

User B try subscribe the node music, but only get a item-not-found(404) error.

the createnode code:

try {

leaf = (LeafNode)mgr.createNode(nodeName);

} catch (XMPPException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

ConfigureForm form = new ConfigureForm(FormType.submit);

form.setAccessModel(AccessModel.open);

form.setDeliverPayloads(false);

form.setNotifyRetract(false);

form.setPersistentItems(true);

form.setMaxItems(1);

form.setPublishModel(PublishModel.open);

try {

leaf.sendConfigurationForm(form);

} catch (XMPPException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

the subscribe node code:

LeafNode node =null;
try {
node = (LeafNode)mgr.getNode(nodeName);//error item not found

          node.addItemEventListener(this);
        node.subscribe(conn.getUser());
    } catch (XMPPException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

All code is attached.

Question: is a openfire bug? smack-pubsubscribe bug? my code bug?

The my code is based in :http://www.igniterealtime.org/fisheye/browse/~raw,r=11345/svn-org/smack/trunk/do cumentation/extensions/pubsub.html
GeradorSenha.zip (9293 Bytes)

Is it possible that you are calling the subscribe method before register? That is the only thing that makes sense offhand. There are testcases for the scenario you are using and they seem to work fine.

Thanks rcollier.

User A run in aplication 1(GeraSenha), User B in aplication 2(Cliente).

A application is started before B application.

User A can subscribe and publish with no problems.

B get erro in getNode…

Wow…

mgr = new PubSubManager(conn); <-error

mgr = new PubSubManager(conn,“pubsub.batutas”); <- with subscribe adress, run ok

seems to be a bug…

Thanks to all.

That isn’t a bug.

You have to address the pubsub service as the destination for your commands, most servers will probably default to pubsub.my.domain, but that isn’t guarenteed (not written into the spec), so you have to be able to input the address of the actual pubsub service.

I will have to check if the default case which doesn’t provide an argument is actually valid, perhaps it should be removed.