You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by sally <sa...@gmail.com> on 2017/11/03 06:40:46 UTC
Nifi:can't import getFileSystem in customProcessor?
I want to use getFileSytem() for pulling in any file that is newer than the
timestamp that we have but I can't import it (I mean getFileSytem()) I have
this code:
final FileSystem hdfs = getFileSystem();
final boolean recursive = context.getProperty(RECURSE_SUBDIRS).asBoolean();
final Set<FileStatus> statuses;
try {
final Path rootPath = new Path(directory);
statuses = getStatuses(rootPath, recursive, hdfs,
createPathFilter(context));
getLogger().debug("Found a total of {} files in HDFS", new Object[]
{statuses.size()});
} catch (final IOException | IllegalArgumentException e) {
getLogger().error("Failed to perform listing of HDFS due to {}", new
Object[]{e});
return;
}
and here is my pom file dependencies:
<parent>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-hadoop-bundle</artifactId>
<version>1.5.0-SNAPSHOT</version>
</parent>
<artifactId>nifi-Reader-processors</artifactId>
<packaging>nar</packaging>
<dependencies>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-utils</artifactId>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-mock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>3.0.0-beta1</version>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-standard-services-api-nar</artifactId>
<version>1.3.0</version>
<type>nar</type>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-properties</artifactId>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-distributed-cache-client-service-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-standard-nar</artifactId>
<type>nar</type>
</dependency>
--
Sent from: http://apache-nifi-users-list.2361937.n4.nabble.com/
Re: Nifi:can't import getFileSystem in customProcessor?
Posted by Mike Thomsen <mi...@gmail.com>.
Maven doesn't handle static imports, that's either a Java or Groovy
compiler issue. So all Maven is telling you is that there is something
wrong between your import statement syntax and the declared dependencies.
Without more than that, I can't really give you an idea of what's wrong.
On Tue, Nov 7, 2017 at 12:51 AM, sally <sa...@gmail.com>
wrote:
> Yes , but when i add this static import i can't run maven
> project ( it doesn't support static imports)
>
>
>
> --
> Sent from: http://apache-nifi-users-list.2361937.n4.nabble.com/
>
Re: Nifi:can't import getFileSystem in customProcessor?
Posted by sally <sa...@gmail.com>.
Yes , but when i add this static import i can't run maven
project ( it doesn't support static imports)
--
Sent from: http://apache-nifi-users-list.2361937.n4.nabble.com/
Re: Nifi:can't import getFileSystem in customProcessor?
Posted by Mike Thomsen <mi...@gmail.com>.
Are you doing the appropriate import static statement to import that static
method?
On Fri, Nov 3, 2017 at 2:40 AM, sally <sa...@gmail.com> wrote:
> I want to use getFileSytem() for pulling in any file that is newer than the
> timestamp that we have but I can't import it (I mean getFileSytem()) I have
> this code:
>
> final FileSystem hdfs = getFileSystem();
> final boolean recursive = context.getProperty(RECURSE_
> SUBDIRS).asBoolean();
>
> final Set<FileStatus> statuses;
> try {
> final Path rootPath = new Path(directory);
> statuses = getStatuses(rootPath, recursive, hdfs,
> createPathFilter(context));
> getLogger().debug("Found a total of {} files in HDFS", new Object[]
> {statuses.size()});
> } catch (final IOException | IllegalArgumentException e) {
> getLogger().error("Failed to perform listing of HDFS due to {}", new
> Object[]{e});
> return;
> }
> and here is my pom file dependencies:
>
> <parent>
> <groupId>org.apache.nifi</groupId>
> <artifactId>nifi-hadoop-bundle</artifactId>
> <version>1.5.0-SNAPSHOT</version>
> </parent>
>
> <artifactId>nifi-Reader-processors</artifactId>
> <packaging>nar</packaging>
>
> <dependencies>
> <dependency>
> <groupId>org.apache.nifi</groupId>
> <artifactId>nifi-api</artifactId>
> </dependency>
> <dependency>
> <groupId>org.apache.nifi</groupId>
> <artifactId>nifi-utils</artifactId>
> </dependency>
> <dependency>
> <groupId>org.apache.nifi</groupId>
> <artifactId>nifi-mock</artifactId>
> <scope>test</scope>
> </dependency>
> <dependency>
> <groupId>org.slf4j</groupId>
> <artifactId>slf4j-simple</artifactId>
> <scope>test</scope>
> </dependency>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <scope>test</scope>
> </dependency>
>
>
> <dependency>
> <groupId>log4j</groupId>
> <artifactId>log4j</artifactId>
> <version>1.2.17</version>
> </dependency>
>
> <dependency>
> <groupId>org.apache.hadoop</groupId>
> <artifactId>hadoop-common</artifactId>
> <version>3.0.0-beta1</version>
> </dependency>
> <dependency>
> <groupId>org.apache.nifi</groupId>
> <artifactId>nifi-standard-services-api-nar</artifactId>
> <version>1.3.0</version>
> <type>nar</type>
> </dependency>
> <dependency>
> <groupId>org.apache.nifi</groupId>
> <artifactId>nifi-properties</artifactId>
> </dependency>
> <dependency>
> <groupId>org.apache.nifi</groupId>
> <artifactId>nifi-distributed-cache-client-service-api</artifactId>
> </dependency>
>
>
> <dependency>
> <groupId>org.apache.nifi</groupId>
> <artifactId>nifi-standard-nar</artifactId>
> <type>nar</type>
> </dependency>
>
>
>
>
>
> --
> Sent from: http://apache-nifi-users-list.2361937.n4.nabble.com/
>