<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Flume custom source in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Flume-custom-source/m-p/67567#M72538</link>
    <description>&lt;P&gt;Thanks, I indeed end up using Maven and plugins.d folder on Flume. Forgot to update the topic, thank you guys for the help!&lt;/P&gt;</description>
    <pubDate>Wed, 23 May 2018 08:26:57 GMT</pubDate>
    <dc:creator>ludof</dc:creator>
    <dc:date>2018-05-23T08:26:57Z</dc:date>
    <item>
      <title>Flume custom source</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Flume-custom-source/m-p/62680#M72535</link>
      <description>&lt;P&gt;Hi everyone, I am trying to use a custom source in Flume but when I start the agent I get a&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;org.apache.flume.FlumeException: Unable to load source type: com.cloudera.flume.source.MySource, class: com.cloudera.flume.source.MySource&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The custom source is specified in the MySource.java file, the package is com.cloudera.flume.source.&lt;/P&gt;
&lt;P&gt;This is what I did:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Compile the java file passing the class path to flume and hadoop libraries (this generates the MySource.class file):&lt;BR /&gt;
&lt;PRE&gt;javac -cp /opt/cloudera/parcels/CDH-5.13.0-1.cdh5.13.0.p0.29/lib/hadoop/*:/opt/cloudera/parcels/CDH-5.13.0-1.cdh5.13.0.p0.29/lib/hadoop-mapreduce/*:/opt/cloudera/parcels/CDH-5.13.0-1.cdh5.13.0.p0.29/lib/flume-ng/lib/* MySource.java -Xlint&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;Create manifest.mf file like the following:&lt;BR /&gt;
&lt;PRE&gt;Manifest-Version: 1.0
Main-Class: com.cloudera.flume.source.MySource&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;Generate&amp;nbsp;the MySource.jar file:&lt;BR /&gt;
&lt;PRE&gt;jar cvfm MySource.jar manifest.mf MySource.class&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;Move the MySource.jar file in the flume library folder:&lt;BR /&gt;
&lt;PRE&gt;sudo mv MySource.jar /opt/cloudera/parcels/CDH-5.13.0-1.cdh5.13.0.p0.29/lib/flume-ng/lib&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;The custom flume configuration file is the following:&lt;BR /&gt;
&lt;PRE&gt;# custom.conf

# Naming the components on the current agent. 
MyAgent.sources = MySource 
MyAgent.channels = MemChannel 
MyAgent.sinks = HDFS
  
# Describing/Configuring the source 
MyAgent.sources.MySource.type = com.cloudera.flume.source.MySource
  
# Describing/Configuring the sink 
MyAgent.sinks.HDFS.type = hdfs 
MyAgent.sinks.HDFS.hdfs.path = /test/flume/mysource-logs
MyAgent.sinks.HDFS.hdfs.fileType = DataStream 
MyAgent.sinks.HDFS.hdfs.writeFormat = Text 
MyAgent.sinks.HDFS.hdfs.batchSize = 1000
MyAgent.sinks.HDFS.hdfs.rollSize = 0 
MyAgent.sinks.HDFS.hdfs.rollCount = 10000 
 
# Describing/Configuring the channel 
MyAgent.channels.MemChannel.type = memory 
MyAgent.channels.MemChannel.capacity = 10000 
MyAgent.channels.MemChannel.transactionCapacity = 100
  
# Binding the source and sink to the channel 
MyAgent.sources.MySource.channels = MemChannel
MyAgent.sinks.HDFS.channel = MemChannel &lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;Then start the agent with the following command:&lt;BR /&gt;
&lt;PRE&gt;flume-ng agent \
--conf /etc/flume-ng/conf \
--conf-file custom.conf \
--name MyAgent \
-Dflume.root.logger=INFO,console&lt;/PRE&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;At this point I get a&amp;nbsp;org.apache.flume.FlumeException, it seems it cannot find&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;com.cloudera.flume.source.MySource&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the library paths included when started the agent I can see the path&amp;nbsp;&lt;EM&gt;/opt/cloudera/parcels/CDH-5.13.0-1.cdh5.13.0.p0.29/lib/flume-ng/lib&lt;/EM&gt; where I copied &lt;EM&gt;MySouce.jar&lt;/EM&gt; file, thus I don't understand why it cannot find the class.&lt;/P&gt;
&lt;P&gt;What am I doing wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ps: I am using CDH 5.13 installed by Cloudera Manager.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 12:37:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Flume-custom-source/m-p/62680#M72535</guid>
      <dc:creator>ludof</dc:creator>
      <dc:date>2022-09-16T12:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Flume custom source</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Flume-custom-source/m-p/67514#M72536</link>
      <description>&lt;P&gt;I feel this is&amp;nbsp;something to do with the way you have created the jar .Do you see the jar when extracted having the same package as shown in the error message?&lt;/P&gt;&lt;P&gt;Also, try adding the full path for the class in the flume config.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 07:00:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Flume-custom-source/m-p/67514#M72536</guid>
      <dc:creator>Smitha</dc:creator>
      <dc:date>2018-05-22T07:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: Flume custom source</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Flume-custom-source/m-p/67515#M72537</link>
      <description>&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/27297"&gt;@Smitha&lt;/a&gt; is right here. The below step specifically is incorrect.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; jar cvfm MySource.jar manifest.mf MySource.class&lt;BR /&gt;&lt;BR /&gt;Your class is within a package (com.cloudera.flume.source) but the jar is loading them into the top level package. The ideal way would be to do this:&lt;BR /&gt;&lt;BR /&gt;~&amp;gt; mkdir -p com/cloudera/flume/source/&lt;BR /&gt;~&amp;gt; mv MySource.class com/cloudera/flume/source/&lt;BR /&gt;~&amp;gt; jar cvf MySource.jar com/cloudera/flume/source/MySource.class&lt;BR /&gt;&lt;BR /&gt;Doing the above steps within your sequence would ensure the class gets placed in the declared package instead of at the top level.&lt;BR /&gt;&lt;BR /&gt;More generally, you can avoid these forms of trivial packaging mistakes by using a formal build tool/system such as Maven, or even IDEs such as IntelliJ or Eclipse which allow archive building from source projects. These package jars for you in the required form, maintaining namespaces perfectly among several other benefits.</description>
      <pubDate>Tue, 22 May 2018 07:20:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Flume-custom-source/m-p/67515#M72537</guid>
      <dc:creator>Harsh J</dc:creator>
      <dc:date>2018-05-22T07:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Flume custom source</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Flume-custom-source/m-p/67567#M72538</link>
      <description>&lt;P&gt;Thanks, I indeed end up using Maven and plugins.d folder on Flume. Forgot to update the topic, thank you guys for the help!&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 08:26:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Flume-custom-source/m-p/67567#M72538</guid>
      <dc:creator>ludof</dc:creator>
      <dc:date>2018-05-23T08:26:57Z</dc:date>
    </item>
  </channel>
</rss>

