java - 无法解析类型 java.rmi.RemoteException。它是从 java 中必需的 .class 文件错误中间接引用的

标签 java web-services jar syntax-error remoteexception

我真的是 Java 的新手,正在尝试调用网络服务。我从网上拿了一个代码

String message = "";
static Map output;

public static void main(String args[]) {
    try {
        String inputparam = "10000";

        Service service = new Service();
        Call call = (Call) service.createCall();

        call.setTargetEndpointAddress(new java.net.URL(""));
        call.setOperationName(new QName("http://testPackage.fc.com/, doBasicStuff"));

        call.addParameter("Hello", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);

        call.setReturnType(org.apache.axis.Constants.XSD_STRING);

        Object responseWS = call.invoke(new Object[] { inpurparam });

        System.out.println("ReceivingResponse: " + (String) responseWS);

        output = call.getOutputParams();

        String firstName = (String) output.get(new QName("", "firstName"));

    } catch (Exception e) {
        System.err.println(e.toString());
    }

}

语法错误

The type java.rmi.RemoteException cannot be resolved. It is indirectly referenced from required .class files

在线

Object responseWS = call.invoke(new Object[] { inpurparam });

所以我添加了“import java.rmi.RemoteException;”声明它给导入语句“导入 java.rmi.RemoteException 无法解析”错误,所以请告诉如何删除这个错误

最佳答案

你需要添加

导入 java.rmi.RemoteException;

在你的类声明之前

关于java - 无法解析类型 java.rmi.RemoteException。它是从 java 中必需的 .class 文件错误中间接引用的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13721982/

相关文章:

Java-Groovy : regex parse text block

web-services - Delphi 2009 Web服务“xml文档必须具有顶层元素”

maven - 在本地Maven存储库中发布hadoop的安装

java - 我可以将 javafx/openjfx 与 OpenJDK 8 一起使用吗?

java - 如何集中 primefaces 菜单栏?

C# 应用程序在 docker 中失败并显示 "cannot start service from the command line"但在主机上没有

java - 使用源代码和 javadoc 构建 jar

java - 从 jar 运行时出现 NoClassDefFoundError

java.sql.SQLException : No suitable driver found for jdbc:mysql://localhost:3306/sushi 异常

java - 在eclipse中添加maven依赖