Jaxb Karaf,ServiceMix奇怪的行为实例

Jaxb Karaf,ServiceMix奇怪的行为实例,jaxb,apache-karaf,apache-felix,apache-servicemix,karaf,Jaxb,Apache Karaf,Apache Felix,Apache Servicemix,Karaf,JAXB RI源代码包含: public void setProperty(String name, Object value) throws PropertyException { if( PREFIX_MAPPER.equals(name) ) { if(!(value instanceof NamespacePrefixMapper)) throw new PropertyException( Message

JAXB RI源代码包含:

public void setProperty(String name, Object value) throws PropertyException {

    if( PREFIX_MAPPER.equals(name) ) {
        if(!(value instanceof NamespacePrefixMapper))
            throw new PropertyException(
                Messages.MUST_BE_X.format(
                        name,
                        NamespacePrefixMapper.class.getName(),
                        value.getClass().getName() ) );
        prefixMapper = (NamespacePrefixMapper)value;
        return;
    }
我这样调用它:

        Class c = Class.forName("org.docx4j.jaxb.ri.NamespacePrefixMapper");
        prefixMapper = c.newInstance();         
        m.setProperty("com.sun.xml.bind.namespacePrefixMapper", prefixMapper );
其中,我的c类声明如下:

public class NamespacePrefixMapper extends com.sun.xml.bind.marshaller.NamespacePrefixMapper 
    implements NamespacePrefixMapperInterface, McIgnorableNamespaceDeclarator 
这通常工作正常(包括在Karaf 4.2.4、ServiceMix 7.0.1中),但我在ServiceMix 5.4.1中遇到了问题

在ServiceMix 5.4.1中,我得到:

javax.xml.bind.PropertyException: property "com.sun.xml.bind.namespacePrefixMapper" must be an instance of type com.sun.xml.bind.marshaller.NamespacePrefixMapper, not org.docx4j.jaxb.ri.NamespacePrefixMapper
    at com.sun.xml.bind.v2.runtime.MarshallerImpl.setProperty(MarshallerImpl.java:502)
这很神秘,因为它扩展了com.sun.xml.bind.marshaller.NamespacePrefixMapper

instanceof在OSGi环境中的行为是否会有所不同


欢迎光临,谢谢

您是否拥有正确的Java环境,