On Fri, Apr 27, 2007 at 10:18:03AM -0500, Davies, Joshua wrote:
> It look as if (somehow) com.echomine.jabber.packet.DiscoverQueryIQPacket
> is being loaded from a different classpath entry than the
> "JiBX_MungeAdapter".  You said you were developing an extension; my best
> guess from the stack trace below is that you're loading
> "DiscoverQueryIQPacket" from your extension's "build" directory, but the
> JiBX_MungeAdapter is coming from a .jar somewhere (that was comipiled
> sometime long ago).  Most likely, you'll need to re-run jibx on the
> whole mess and make sure that none of the old classes are loaded from
> .jars.
> 
> Like I said, though, I'm just guessing from the stack trace; if you
> want, post more details on exactly what you're doing, and I'll see if I
> can offer any more clues.

Oh, to post what I'm doing I need to spend a lot of time explaining feridian,
which I'm not enough familiar with ;) I bet I can't explain what is going on
:(

I'm just trying to extend feridian with new packets, I created jibx mapping (I
altered it a bit to support collections instead of arrays, as before, and
exception was changed a bit

Exception in thread "Feridian - office.redwerk.com" 
java.lang.NoSuchMethodError: 
com.echomine.jabber.packet.JiBX_MungeAdapter.JiBX_jep_0030_binding_newinstance_1_0(Lorg/jibx/runtime/impl/UnmarshallingContext;)Ljava/util/ArrayList;
        at 
com.echomine.jabber.packet.DiscoveryQueryIQPacket.JiBX_jep_0030_binding_unmarshal_3_0(DiscoveryQueryIQPacket.java)
        at 
com.echomine.jabber.packet.JiBX_jep_0030_bindingDiscoveryQueryIQPacket_access.unmarshal()
        at org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(Unknown 
Source), 

so it looks like changes I made were compiled, and this is not a
classpath-related issue )

The binding is:

<!-- Binding for JEP-0030: Service discovery -->
<binding>
    <!-- setup serializers/deserializers -->
    <format type="com.echomine.xmpp.JID" 
serializer="com.echomine.xmpp.JID.toString"
        deserializer="com.echomine.xmpp.JID.parseJID"/>
    <mapping name="query" ns="http://jabber.org/protocol/disco#info"; 
ordered='false'
        class="com.echomine.jabber.packet.DiscoveryQueryIQPacket">
        <namespace uri="http://jabber.org/protocol/disco#info"; 
default="elements"/>
        <collection field="features" type="java.util.ArrayList" 
usage="optional">
            <structure name="feature" type="com.echomine.jabber.packet.Feature">
                <value style="attribute" name="var" field="var" />
            </structure>
        </collection>
        <collection field="identities" type="java.util.ArrayList" 
usage="optional">
            <structure name="identity" 
type="com.echomine.jabber.packet.Identity">
                <value style="attribute" name="category" field="category" />
                <value style="attribute" name="type" field="type" />
                <value style="attribute" name="name" field="name" />
            </structure>
        </collection>
    </mapping>
</binding>

when I'm running this test:

package com.echomine.jabber.packet;

import java.io.StringReader;

import com.echomine.jibx.JiBXUtil;
import com.echomine.xmpp.JID;
import com.echomine.xmpp.XMPPTestCase;
import com.echomine.xmpp.packet.IQPacket;

/**
 * 
 */
public class DiscoveryQueryIQPacketTest extends XMPPTestCase {

    private static final String SOURCE_DOMAIN_ORG = "[EMAIL PROTECTED]";

    private static final String TARGET_DOMAIN_ORG = "[EMAIL PROTECTED]";

    public void testUnmarshall() throws Exception {
        String xml = "<query xmlns='http://jabber.org/protocol/disco#info'/>";
        StringReader reader = new StringReader(xml);
        DiscoveryQueryIQPacket discovery = (DiscoveryQueryIQPacket) JiBXUtil
                .unmarshallObject(reader, DiscoveryQueryIQPacket.class);
        assertNotNull(discovery);
        assertNull(discovery.getFeatures());
        assertNull(discovery.getIdentities());
        assertNull(discovery.getItems());
        reader.close();
        reader = new StringReader(
                "<query xmlns='http://jabber.org/protocol/disco#info'>"
                        + "<identity category='conference' type='text' 
name='Play-Specific Chatrooms'/>"
                        + "<identity category='directory' type='chatroom' 
name='Play-Specific Chatrooms'/>"
                        + "<feature 
var='http://jabber.org/protocol/disco#info'/>"
                        + "<feature 
var='http://jabber.org/protocol/disco#items'/>"
                        + "<feature var='http://jabber.org/protocol/muc'/>"
                        + "<feature var='jabber:iq:register'/>"
                        + "<feature var='jabber:iq:search'/>"
                        + "<feature var='jabber:iq:time'/>"
                        + "<feature var='jabber:iq:version'/>" + "</query>");
        discovery = (DiscoveryQueryIQPacket) JiBXUtil.unmarshallObject(reader,
                DiscoveryQueryIQPacket.class);
        assertNotNull(discovery);
        assertNotNull(discovery.getFeatures());
        assertEquals(7, discovery.getFeatures().size());
        assertNotNull(discovery.getIdentities());
        assertEquals(2, discovery.getIdentities().size());
        reader.close();
        reader = new StringReader(
                "<iq xmlns='jabber:client' type='result' ><query 
xmlns='http://jabber.org/protocol/disco#info'>"
                        + "<identity category='conference' type='text' 
name='Play-Specific Chatrooms'/>"
                        + "<identity category='directory' type='chatroom' 
name='Play-Specific Chatrooms'/>"
                        + "<feature 
var='http://jabber.org/protocol/disco#info'/>"
                        + "<feature 
var='http://jabber.org/protocol/disco#items'/>"
                        + "<feature var='http://jabber.org/protocol/muc'/>"
                        + "<feature var='jabber:iq:register'/>"
                        + "<feature var='jabber:iq:search'/>"
                        + "<feature var='jabber:iq:time'/>"
                        + "<feature var='jabber:iq:version'/>"
                        + "</query></iq>");
        discovery = (DiscoveryQueryIQPacket) JiBXUtil.unmarshallObject(reader,
                IQPacket.class);
        assertNotNull(discovery);
        assertNotNull(discovery.getFeatures());
        assertEquals(7, discovery.getFeatures().size());
        assertNotNull(discovery.getIdentities());
        assertEquals(2, discovery.getIdentities().size());
        reader.close();
    }

    public void testMarshalling() throws Exception {
        StringReader reader = new StringReader(
                "<iq xmlns='jabber:client' type='get' from='"
                        + SOURCE_DOMAIN_ORG
                        + "' to='"
                        + TARGET_DOMAIN_ORG
                        + "'><query 
xmlns='http://jabber.org/protocol/disco#info'></iq>");
        Feature feature = new Feature();
        feature.setVar("testVar");
        DiscoveryQueryIQPacket discoveryPacket = new DiscoveryQueryIQPacket();
        //                discoveryPacket.setFeatures(new Feature[] { feature 
});
        discoveryPacket.setTo(JID.parseJID(TARGET_DOMAIN_ORG));
        discoveryPacket.setFrom(JID.parseJID(SOURCE_DOMAIN_ORG));
        discoveryPacket.setType(IQPacket.TYPE_GET);
        JiBXUtil.marshallIQPacket(writer, discoveryPacket);
        //        compare(reader);
    }

}

everything works just fine, but If I try to use new class to parse XML, the
error occurs :(

Makes sence for you or may be you need to know some more specific
details/sources?

-- 
Eugene N Dzhurinsky

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to