您好在我的程序中有两个引用路径的导入。一个路径是指 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/