Support Questions

Find answers, ask questions, and share your expertise

I am trying to build a Kafka Producer using Java and Maven.

avatar
Explorer

I am trying to build a Kafka Producer using Java and Maven. According to this article (https://community.hortonworks.com/articles/51122/simple-kafka-producer-using-java-in-a-kerberozied.html) I have to modify the pom.xml file in order to use the org.apache.kafka dependency. Unnfortunatelly, when I build the project, the following error is shown:

ERROR:

[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building abud 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ abud --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /root/Documents/MavenExamples/abud/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ abud --- [INFO] Compiling 1 source file to /root/Documents/MavenExamples/abud/target/classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.607s [INFO] Finished at: Sun Jan 29 00:49:27 EST 2017 [INFO] Final Memory: 15M/483M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project abud: Compilation failure [ERROR] /root/Documents/MavenExamples/abud/src/main/java/com/tecnisys/App.java:[20,19] error: generics are not supported in -source 1.3 [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

,

15 REPLIES 15

avatar
Master Mentor

@Rafael Menezes

If you want to run the code completely using Maven itself then you should refer to :

http://www.java2s.com/Tutorials/Java/Maven_Tutorial/2030__Maven_Run_Java_Main.htm

Which talks about the Maven exec plugin

exec:java

avatar
Master Mentor

@Rafael Menezes

If the issue described in the original thread is resolved then please mark the answer as accepted.

avatar
Explorer

Dear Jay,

the code is running. It is almost everything Ok. I suppose it pass by Kerberos, as you can see below:

>>>KinitOptions cache name is /tmp/krb5cc_0 >>>DEBUG <CCacheInputStream> client principal is root@KERBEROS.COM >>>DEBUG <CCacheInputStream> server principal is krbtgt/KERBEROS.COM@KERBEROS.COM >>>DEBUG <CCacheInputStream> key type: 18 >>>DEBUG <CCacheInputStream> auth time: Sun Jan 29 04:30:11 EST 2017 >>>DEBUG <CCacheInputStream> start time: Sun Jan 29 04:30:11 EST 2017 >>>DEBUG <CCacheInputStream> end time: Mon Jan 30 04:29:38 EST 2017 >>>DEBUG <CCacheInputStream> renew_till time: null >>> CCacheInputStream: readFlags() FORWARDABLE; PROXIABLE; INITIAL; >>>DEBUG <CCacheInputStream> client principal is root@KERBEROS.COM >>>DEBUG <CCacheInputStream> server principal is X-CACHECONF:/krb5_ccache_conf_data/fast_avail/krbtgt/KERBEROS.COM@KERBEROS.COM@KERBEROS.COM >>>DEBUG <CCacheInputStream> key type: 0 >>>DEBUG <CCacheInputStream> auth time: Wed Dec 31 19:00:00 EST 1969 >>>DEBUG <CCacheInputStream> start time: null >>>DEBUG <CCacheInputStream> end time: Wed Dec 31 19:00:00 EST 1969 >>>DEBUG <CCacheInputStream> renew_till time: null >>> CCacheInputStream: readFlags() >>> unsupported key type found the default TGT: 18 >>> KeyTabInputStream, readName(): KERBEROS.COM >>> KeyTabInputStream, readName(): root >>> KeyTab: load() entry length: 51; type: 23 Looking for keys for: root@KERBEROS.COM Added key: 23version: 2 >>> KdcAccessibility: reset Looking for keys for: root@KERBEROS.COM Added key: 23version: 2 Using builtin default etypes for default_tkt_enctypes default etypes for default_tkt_enctypes: 17 16 23. >>> KrbAsReq creating message >>> KrbKdcReq send: kdc=localhost UDP:88, timeout=30000, number of retries =3, #bytes=132 >>> KDCCommunication: kdc=localhost UDP:88, timeout=30000,Attempt =1, #bytes=132 >>> KrbKdcReq send: #bytes read=618 >>> KdcAccessibility: remove localhost Looking for keys for: root@KERBEROS.COM Added key: 23version: 2 >>> EType: sun.security.krb5.internal.crypto.ArcFourHmacEType >>> KrbAsRep cons in KrbAsReq.getReply root

But the message doesnt reach the topic.

Could you help me?

Thanks!

avatar
Master Mentor

@Rafael Menezes

Your current issue is *Completely* different from the original issue that was asked in the original thread. Hence i would suggest you to open a separate thread with the current Kerberos related error. That will help in managing good community threads.

avatar
Explorer

So sorry...

avatar
New Contributor

please answer this problem

log4j:WARN No appenders could be found for logger (kafka.utils.VerifiableProperties). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" java.lang.NoSuchMethodError: org.apache.kafka.common.utils.Utils.getContextOrKafkaClassLoader()Ljava/lang/ClassLoader; at kafka.utils.CoreUtils$.createObject(CoreUtils.scala:221) at kafka.producer.Producer.<init>(Producer.scala:61) at kafka.javaapi.producer.Producer.<init>(Producer.scala:26) at tweetstreaming.TwitterKafkaProducer.run(TwitterKafkaProducer.java:32) at tweetstreaming.TwitterKafkaProducer.main(TwitterKafkaProducer.java:69)