JAXB default annotated classes not implemented

Issue #168 new
Former user created an issue

As part of a websocket / XMPP application using 0.9.0-SNAPSHOT, the application code defines a XmppSessionConfiguration.builder() (with Extensionclasses) and WebSocketConnectionConfiguration.builder() before creating and connecting XmppClient.

However, from debug, it is observed that annotated classes supposed to be loaded from Module.class/ExtensionModule.class as part of XmppSessionConfiguration.builder() are not implemented in the JAXBContext:

// Find all modules, then add all extension from each module.
        ServiceLoader<Module> loader = ServiceLoader.load(Module.class);
        for (Module module : loader) {
            extensions.addAll(module.getExtensions());
        }

        // Then remove any extensions, which are custom defined, e.g. a new Roster extension for the jabber:iq:roster class.
        this.extensions.removeAll(builder.extensions);
        // Then add the custom extensions.
        this.extensions.addAll(builder.extensions);

        Collection<Class<?>> classesToBeBound = new ArrayDeque<>();
        // For each extension, get its classes in order to add them to the JAXBContext.
        for (Extension extension : extensions) {
            classesToBeBound.addAll(extension.getClasses());
        }
        jaxbContext = XmppUtils.createContext(classesToBeBound);

From the XmppUtils.class, debugging which classes are received to the createContext method, only classes defined by application Extensions and websocket Open.class and Close.class are implemented in the JAXB instance.

So, during websocket handshake/frames, the correct schemas are not loaded, and the connection fails. When including classes as part of application Extensions, the classes and schemes are loaded, and the websocket connection progresses. However, high risk of not getting all required classes and schemes implemented, as they are defined "manually".

Comments (0)

  1. Log in to comment