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

标签 java spring hadoop

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

相关文章:

java - 如何将字符串分成两个字符的子串

java - org.hibernate.TransientObjectException : object references an unsaved transient instance - save the transient instance before flushing

java - hbase数据的分布式分析

java - 二进制幂错误

java - 为什么 .NET 是框架而 Java 是语言

spring - primefaces.THEME 值在 web.xml 中被忽略

所有节点的 Hadoop 版本

hadoop - hive :尝试映射键和值时出错

java - 更改已初始化控件的样式位

java - spring 有什么方法可以记录特定 JPA 存储库的查询吗?