简体   繁体   English

找不到提供程序com.sun.xml.rpc.client.ServiceFactoryImpl

[英]Provider com.sun.xml.rpc.client.ServiceFactoryImpl not found

I'm trying to make a call to a web service with following code: 我正在尝试使用以下代码调用Web服务:

/* 
 * A sample Java code for the Termine Web Service.
 */

import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.rpc.*;
import javax.xml.rpc.encoding.XMLType;

public class termine
{

  public static void main(String[] args) throws Exception
  {

    String sentence = "Technical terms are important for knowledge mining, especially in the bio-medical area where vast amount of documents are available.";

    String wsdlURL = "http://www.nactem.ac.uk/software/termine/webservice/termine.wsdl";
    URL url = new URL(wsdlURL);
    String targetNamespace = "urn:termine";
    String   serviceName = "termine";
    String      portName = "termine_porttype";
    String operationName = "analyze";
    QName    serviceQN   = new QName(targetNamespace, serviceName);
    QName       portQN   = new QName(targetNamespace, portName);
    QName  operationQN   = new QName(targetNamespace, operationName);

    try
    {
      ServiceFactory serviceFactory = ServiceFactory.newInstance();
      Service service = serviceFactory.createService(url, serviceQN);

      Call call = (Call) service.createCall();
      call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY, "");
      call.setProperty(Call.OPERATION_STYLE_PROPERTY, "wrapped");
      call.setTargetEndpointAddress("http://www.nactem.ac.uk:9000/termine");

      call.setPortTypeName(portQN);
      call.setOperationName(operationQN);

      call.removeAllParameters();
      call.addParameter("src",           XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("input_format",  XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("output_format", XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("stoplist",      XMLType.XSD_STRING, ParameterMode.IN);
      call.addParameter("filter",        XMLType.XSD_STRING, ParameterMode.IN);

      Object[] inParams = new Object[] {sentence, "", "xml", "", ""};

      call.setReturnType(XMLType.XSD_STRING);

      System.out.println(call.invoke(inParams));
    }
    catch (Exception e) {e.printStackTrace();} 
  }
}

However, I receive the following error. 但是,我收到以下错误。

javax.xml.rpc.ServiceException: Provider com.sun.xml.rpc.client.ServiceFactoryImpl not found at javax.xml.rpc.FactoryFinder.newInstance(FactoryFinder.java:44) at javax.xml.rpc.FactoryFinder.find(FactoryFinder.java:137) at javax.xml.rpc.ServiceFactory.newInstance(ServiceFactory.java:58) at com.ivita.termExtraction.termine.main(termine.java:31) javax.xml.rpc.ServiceException:在javax.xml.rpc.FactoryFinder.find(java.xml.rpc.FactoryFinder.newInstance(FactoryFinder.java:44)处找不到提供者com.sun.xml.rpc.client.ServiceFactoryImpl位于com.ivita.termExtraction.termine.main(termine.java:31)的javax.xml.rpc.ServiceFactory.newInstance(ServiceFactory.java:58)的FactoryFinder.java:137)

From reading about similar problems on the web I got the impression that I'm not using the right libraries. 通过阅读有关网络上类似问题的信息,我得到的印象是我没有使用正确的库。 In my pom.xml I have the following dependencies provided: 在我的pom.xml中,提供了以下依赖项:

<dependency>
    <groupId>javax.xml</groupId>
    <artifactId>jaxrpc-api</artifactId>
    <version>1.1</version>
</dependency>
<dependency>
    <groupId>org.apache.axis</groupId>
    <artifactId>axis-jaxrpc</artifactId>
    <version>1.4</version>
</dependency>
<dependency>
    <groupId>xerces</groupId>
    <artifactId>xercesImpl</artifactId>
    <version>2.11.0</version>
</dependency>

Could you please help me to resolve this problem? 您能帮我解决这个问题吗? Thanks! 谢谢!

Adding the following dependency to my pom.xml solved the problem (partially because other dependencies seem to be still missing). 将以下依赖项添加到我的pom.xml中可以解决此问题(部分原因是似乎仍然缺少其他依赖项)。

<dependency>
    <groupId>javax.mail</groupId>
    <artifactId>mail</artifactId>
    <version>1.4</version>
</dependency>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 JAX-RPC com.sun.xml.rpc.client.BasicService 未找到 - JAX-RPC com.sun.xml.rpc.client.BasicService Not Found 找不到提供程序oracle.j2ee.ws.client.ServiceFactoryImpl - Provider oracle.j2ee.ws.client.ServiceFactoryImpl not found 找不到com.sun.xml.rpc.tools.ant.Wscompile - com.sun.xml.rpc.tools.ant.Wscompile cannot be found 无法创建 SOAP 连接工厂:找不到提供程序 com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnectionFactory - Unable to create SOAP connection factory: Provider com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnectionFactory not found javax.xml.ws.WebServiceException:找不到提供者com.sun.xml.internal.ws.spi.ProviderImpl - javax.xml.ws.WebServiceException: Provider com.sun.xml.internal.ws.spi.ProviderImpl not found Oracle JVM运行时错误:找不到提供程序com.sun.xml.stream.ZephyrParserFactory - Oracle JVM runtime error: Provider com.sun.xml.stream.ZephyrParserFactory not found JDK 1.8 JAXB:未找到提供程序com.sun.xml.bind.v2.ContextFactory - JDK 1.8 JAXB: Provider com.sun.xml.bind.v2.ContextFactory not found 警告:未找到提供程序 com.sun.xml.internal.bind.v2.ContextFactory - WARNING: Provider com.sun.xml.internal.bind.v2.ContextFactory not found 在jira中使用jaxb api失败的java类:提供者com.sun.xml.bind.v2.ContextFactory未找到 - java class using jaxb api failing in jira with : Provider com.sun.xml.bind.v2.ContextFactory not found JDK 11; JAX-WS; 未找到提供程序 com.sun.xml.internal.ws.spi.ProviderImpl - JDK 11; JAX-WS; Provider com.sun.xml.internal.ws.spi.ProviderImpl not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM