Implementing a Flume Sink - flume

So, I need to implement my own Flume sink. I went through this link, but my only missing part is, what do I exactly do once I am done with my Java implementation? Compile it into a .class? JAR? and how to I configure Flume to use my custom sink?
Thanks

Compile it and package it into a jar. Then put the jar in <apache flume install dir>/lib. Then you can refer to your class with its fully qualified name in a sink definition.

Related

where to get Apache Tika jar?

All:
I try to build app using Apache Tika to parse PDF, but I wonder where can I get those libraries like tika-core/target/tika-core-.jar and tika-parsers/target/tika-parsers-.jar
I only find tika-app but there is no such jar like above.
http://tika.apache.org/1.11/gettingstarted.html
Apache Tika has a large number of dependencies it needs to run. Without those present, it will do very little!
You therefore need do use a dependency management tool to not only get Apache Tika, but also the other libraries it needs. If you're using Apache Maven to do that, you can follow the instructions on the Tika website to add it as a dependency to your project with a section in your pom like:
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>1.11</version>
</dependency>
The Apache Tika quickstart page also lists instructions on adding a dependency to Tika, along with all required dependencies, for both Gradle and Ivy builds too. You really ought to be using one of Maven, Gradle or Ivy to be handling the dependencies for you
If you really do want to handle all the dependencies yourself, you can find the Tika Core and Tika Parsers binary jars on Maven central, in the usual place. For Tika 1.11, that's here for the tika-core jar and here for the tika-parsers jar. But, as previously mentioned, you almost certainly don't want to be doing that by hand!

ANT Script Build Messages into a log4j configured log file

I am developing a java project using Eclipse as IDE and ant as the build tool. For logging I am making use of log4j library. I am able to get the log messages in a log file for my whole application using log4j configuration.
But when I build project using ANT, the ANT build messages are still posted to console.I want to make sure that when I build the project, the build messages that ANT generates, like build failure/success, should also be posted to that sames logger file using log4j.
Please help me in this if anyone has got an idea. Thanks
To pass the logging log4j, you can use this when you run Ant:
$ ant -listener org.apache.tools.ant.listener.Log4jListener
The configuration of log4j is then up to you. See the information on Listeners in the Ant manual.

Grails can't find classes in jars

I have an app in Grails that uses a .java to manage paypal MassPay feature. Like many .java, it needs some jars that enclose the classes that jar uses. Ok, i import that jars and the errors in the .java dissapears. But now, when I try to run the app, i receive 25 messages like this:
myapproute/grails-app/controllers/com/mycompany/widget/MassPay.java:3: package com.paypal.sdk.profiles does not exist
import com.paypal.sdk.profiles.APIProfile;
That file in the MassPay.java does not throw any error, since i imported the jar where that class is enclosed. But it doesn't allow me to run the project.
Any help? thanks.
Im using Eclipse, not NetBeans (i have read that there is a bug in Netbeans)
Adding JARs to the Eclipse project build path is not sufficient to make them visible to Grails. You need to either put them in the application's lib directory and run grails compile --refresh-dependencies or (better) if the JARs are available in a Maven-compatible repository simply declare your dependencies in BuildConfig.groovy and let Grails download the JARs itself.
Run this - it will work
grails clean

How to import groovyx.net.http

I don't understand maven or grape, and I'm an idiot so give me the step by step if your answer is "go grap X-dependency manager and then rtfm and you're set." Where do i find and dump files to make this line work:
import groovyx.net.http.HTTPBuilder
It says Groovy: unable to resolve class groovyx.net.http.HTTPBuilder
Also I am unable to import groovyx.net.http.ContentType.URLENC It says unable to resolve class groovyx.net.http.ContentType.URLENC
Update:
apparently you can uncomment the line mavenRepo "http://repository.codehaus.org" in BuildConfig.groovy
Since you're talking about BuildConfig.groovy I assume the question is targeted at using HttpBuilder in a grails application. If so, you could either use
compile('org.codehaus.groovy.modules.http-builder:http-builder:0.5.0') {
excludes "commons-logging", "xml-apis", "groovy"
}
in the dependencies-section of BuildConfig.groovy, or, even more easier, just install the rest plugin:
grails install-plugin rest
try importing the .jar for HTTPBuilder-http://repository.codehaus.org/org/codehaus/groovy/modules/http-builder/http-builder/0.5.2/
Thom Nichols actually provided a helpful answer at http://groovy.329449.n5.nabble.com/problem-running-http-builder-code-td3995735.html to a similar question.
Basically, you can get into one of the snapshot directories at http://snapshots.repository.codehaus.org/org/codehaus/groovy/modules/http-builder/http-builder/ and download one of the packages ending with 'all'. Inside there, you'll find a dependencies directory that contains all the dependencies you need, which you can place in your lib directory. The root of the all zip (or tar) file should contain the main http-builder-#.#-SNAPSHOT.jar, which you should also place in lib.
I was doing this just from the Groovy Console. For Grails, I imagine Stefan's answer of just installing the Grails rest plugin is the best bet.

Problem with dependencies using Ant from the shell

I'm having problems building my project, using an Ant script, from the command prompt using Ant itself. It can't find a certain import for a particular Java file in my project (which has nearly 5,000 source files as it is). The import is included in a .jar package whose location I have set in the Ant file itself. (As a pathelement, along with other needed JARs that either are fine, or haven't tried to been used when the crash occurs). The crash happens with javac, with the simple message of "import etc.ect.* cannot be found at line etc" Oddly enough, I can build the project just fine from the Ant file using an IDE like Eclipse. Any ideas what could be wrong? Thanks!
Wow, the solution was completely unrelated. It was a dumb fault in the java code where the class was trying to import .* from a directory that only had folders in it. For some reason, Eclipse didn't seem to mind, but javac did!
Eclipse's root classloader contains a lot of classes, when you run ant from console there's much less.
Just tell javac task to use the required .jar, and you'll be fine.
You should post the stack trace, does it say "import required by ..."? ( I forget the exact text). Likely there's a jar that's available in your eclipse environment that is not included in your ant script. Look in the stack trace for the missing class to identify the jar that's not being included in your build.

Resources