Smack error in pubsub subscribe response

Hi, this is my first post here and my english is not very good, so sorry for that
I’m working with a pubsub node, which is in authorize mode.
i make a StanzaListener on the owner of the node to authorize the subscription of users:

(i think the next code is ok, but i put it because i think it can help to understand and i dont know if this is the best way to do it)

StanzaListener myListener = new StanzaListener() {
            public void processPacket(Stanza packet) {
               for(ExtensionElement extension : packet.getExtensions())
               {
                    switch (extension.getNamespace())
                    {
                         ...
                         case "jabber:x:data":
                            Form form=Form.getFormFrom(packet);
                            if (form.getField("FORM_TYPE").getValues().get(0).equals("http://jabber.org/protocol/pubsub#subscribe_authorization"))
                            {
                                Form answer = form.createAnswerForm();
                                for (FormField field : answer.getFields())
                                {
                                    switch(field.getVariable())
                                    {
                                        case "pubsub#allow":
                                            //I know, i accept all users for know
                                            field.addValue("true");
                                            break;
                                        case "FORM_TYPE":
                                            break;
                                        default:
                                            field.addValues(form.getField(field.getVariable()).getValues());
                                    }
                                }
                                Message respuesta = new Message(packet.getFrom());
                                respuesta.setFrom(packet.getTo());
                                respuesta.setStanzaId(packet.getStanzaId());
                                respuesta.addExtension(answer.getDataFormToSend());
                                try {
                                    connection.sendStanza(respuesta);
                                } catch (SmackException.NotConnectedException ex) {
                                    Logger.getLogger(Xmpp.class.getName()).log(Level.SEVERE, null, ex);
                                }
                                break;
                             }
                             ...

The problem is that when a user try to subscribe to the node, with this code:

LeafNode node = pubsubManager.getNode("thePubsubNode");
node.addItemEventListener(new ItemPubsubListener());
node.subscribe("validUser@validServer");

it gets this message error in the console:

Connection closed with error

java.lang.ClassCastException: org.jivesoftware.smack.packet.DefaultExtensionElement cannot be cast to org.jivesoftware.smackx.pubsub.NodeExtension

at org.jivesoftware.smackx.pubsub.provider.EventProvider.createReturnExtension(Eve ntProvider.java:39)

at org.jivesoftware.smackx.pubsub.provider.EventProvider.createReturnExtension(Eve ntProvider.java:34)

at org.jivesoftware.smack.provider.EmbeddedExtensionProvider.parse(EmbeddedExtensi onProvider.java:108)

at org.jivesoftware.smack.provider.EmbeddedExtensionProvider.parse(EmbeddedExtensi onProvider.java:84)

at org.jivesoftware.smack.provider.Provider.parse(Provider.java:35)

at org.jivesoftware.smack.util.PacketParserUtils.parseExtensionElement(PacketParse rUtils.java:929)

at org.jivesoftware.smack.util.PacketParserUtils.addExtensionElement(PacketParserU tils.java:1060)

at org.jivesoftware.smack.util.PacketParserUtils.parseMessage(PacketParserUtils.ja va:287)

at org.jivesoftware.smack.util.PacketParserUtils.parseStanza(PacketParserUtils.jav a:151)

at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMP PConnection.java:956)

at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$500(XMPPTCPConnection.java: 140)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:989)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPCon nection.java:944)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:959)

at java.lang.Thread.run(Thread.java:745)

i dont receive the answer with the approval notification in the smack debug window, and i cant make a StanzaListener, because the error occur before

I’m using smack 4.1.4, on a 15.06 ejabberd server (draugr.de)

thanks in advance and if you need more information just tell me

Could you show us the stanza trace when the code in question is executed? More information how to obtain the trace can be found at https://github.com/igniterealtime/Smack/wiki/How-to-ask-for-help,-report-an-issu e-and-possible-solve-the-problem-yourself

  1. Subscriber - PubSub Server trace:

a) Subscriber send a subscription request

<subscribe node="testNode" jid="testSubscriber@draugr.de"/>

b) Server replies with pending

<subscription jid="testSubscriber@draugr.de" node="testNode" subscription="pending"/>
  1. Server - owner trace:

a) Server sends authorization request to node owner

PubSub subscriber request

Choose whether to approve this entity’s subscription.

  <value>http://jabber.org/protocol/pubsub#subscribe_authorization</value>

testNode

  <value>testSubscriber@draugr.de</value>

false

b) Owner approves subscription request

  <value>http://jabber.org/protocol/pubsub#subscribe_authorization</value>

testNode

  <value>testSubscriber@draugr.de</value>

true

And then, based on XEP 0060 - Publish-Subscribe, there must be a message from the server to the subscriber, with the approval notification, but the error that i mention before, appears.

Obs: the smack debuger window tell that the error occur in the subscriber user