gpt4 book ai didi

java - 无法在java中使用两个调用函数

转载 作者:可可西里 更新时间:2023-11-01 15:30:34 27 4
gpt4 key购买 nike

您好在我的程序中有两个引用路径的导入。一个路径是指 web service Annotation 另一个路径是指 HDFS .但它相互冲突并抛出一个错误

我的程序。

import javax.ws.rs.Path;
import org.apache.hadoop.conf.Configuration ;
@Path("/oozie")
public class RestServiceOozie {
@GET
@Path("/{param}/{param2}/{param3}/{param4}")
String arguments = "hdfs://nameservice1/user/ec2-user/" + bedroom + "-" + bathroom + "-" + area + "-" + city;
Configuration configuration = new Configuration();
FileSystem fileSystem = FileSystem.get(configuration);
Path path = new Path(arguments); // getting error on this path
if (!fileSystem.exists((org.apache.hadoop.fs.Path)path)) {
System.out.println("File does not exists");
}

我在路径上遇到错误。任何帮助将不胜感激。

最佳答案

如果有歧义,请使用完全限定的 {Class|Interface|Annotation} 名称。另外,我猜你忘了在你的代码中声明一个方法。

import  org.apache.hadoop.conf.Configuration;
import javax.ws.rs.Path;

@Path("/oozie")
public class RestServiceOozie {

@GET
@org.apache.hadoop.fs.Path("/{param}/{param2}/{param3}/{param4}")
public void fooMethod() {
String arguments = "hdfs://nameservice1/user/ec2-user/" + bedroom + "-" + bathroom + "-" + area + "-" + city;
Configuration configuration = new Configuration();
FileSystem fileSystem = FileSystem.get(configuration);
org.apache.hadoop.fs.Path path = new org.apache.hadoop.fs.Path(arguments); // getting error on this path
if (!fileSystem.exists((org.apache.hadoop.fs.Path)path)) {
System.out.println("File does not exists");
}
}
}

关于java - 无法在java中使用两个调用函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34265194/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com