您好在我的程序中有两个引用路径的导入。一个路径指的是web service
Annotation
,另一个路径指的是HDFS
。
但它相互冲突且throws
错误。
我的节目。
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");
}
我在路上遇到错误。任何帮助将不胜感激。
答案 0 :(得分:1)
如果存在歧义,请使用完全限定的{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");
}
}
}