首页 > 解决方案 > 在调用 ihe.iti.xds_b._2007.DocumentRepositoryService 对象的 getDocumentRepositoryPortSoap12 方法时,不能将 JaxbAccessorF_value 强制转换为...

问题描述

我正在修改/更正代码,以实现我们提供的xd-commonjava 代码repo1.maven.org/maven2/org/nhind/xd-common/

当调用以下...

proxy = service.getDocumentRepositoryPortSoap12(new MTOMFeature(true, 1));

...日志显示

“axbAccessorF_value 无法转换为 com.sun.xml.internal.bind.v2.runtime.reflect.Accessor”

我已经查看了几个地方的解决方案。许多人认为问题可能与类路径上的重复 JAXB 库有关,并且在某些情况下,请求 Maven 依赖关系树来解决此问题。我已经包含了 Maven 依赖树;但是,我不知道如何从中分辨出重复的类路径。

错误发生在DocumentRepositoryProxy类中org.nhindirect.xd.proxy

private void initProxy()
{
    try
    {
         URL url = DocumentRepositoryProxy.class.getClassLoader().getResource(
                "XDS.b_DocumentRepositoryWSDLSynchMTOM.wsdl");

        LOGGER.info("url: " + url.toString());

        QName qname = new QName("urn:ihe:iti:xds-b:2007", "DocumentRepository_Service");
        DocumentRepositoryService service = new DocumentRepositoryService(url, qname);

        if (handlerResolver != null)
            service.setHandlerResolver(handlerResolver);

        LOGGER.info("Before getDocumentRepositoryPortSoap12");
        proxy = service.getDocumentRepositoryPortSoap12(new MTOMFeature(true, 1));
        LOGGER.info("After getDocumentRepositoryPortSoap12");

        BindingProvider bp = (BindingProvider) proxy;
        SOAPBinding binding = (SOAPBinding) bp.getBinding();
        binding.setMTOMEnabled(true);

        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
    }
    catch (Exception e)
    {
        LOGGER.error("Error initializing proxy.", e);
    }
}

标签: javamavenservice

解决方案


推荐阅读