Member since
01-30-2017
10
Posts
0
Kudos Received
0
Solutions
01-30-2017
07:27 PM
So sorry...
... View more
01-30-2017
07:19 PM
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!
... View more
01-30-2017
05:15 PM
Jay, maybe I need to study a lot more Maven, but in at my knowledge this POM is enough to reference kafka-clients, isn't it? <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.tecnisys</groupId> <artifactId>abud</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>abud</name>
<url>http://maven.apache.org</url> <dependencies>
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version>
<scope>test</scope>
</dependency> <dependency> <groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>0.10.1.1</version> </dependency> </dependencies>
<build> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration> </plugin>
</plugins>
</build>
</project>
... View more
01-30-2017
04:20 PM
Dear Jay, I couldnt use the KafkaProducer class. The following erros was shown: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/kafka/clients/producer/KafkaProducer
at com.tecnisys.App.main(App.java:27)
Caused by: java.lang.ClassNotFoundException: org.apache.kafka.clients.producer.KafkaProducer
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more I import org.apache.kafka.clients.producer.KafkaProducer and put org.apache.kafka as a dependency in pom.xml.
... View more
01-30-2017
03:32 PM
The POM was Ok. I only put import org.apache.kafka.clients.producer.KafkaProducer; I thought that the mention in the pom would be enough. Until this point it is ok. Thanks a lot, Jay!
... View more
01-30-2017
03:27 PM
Jay, thanks for the very quick reply. Here is the code I put in line 25: KafkaProducer<String,String> producer = new KafkaProducer<String, String>(properties);
... View more
01-30-2017
03:16 PM
Thanks, Jay. Now it works, but instead of 1.6 I put 1.8. Unfortunatelly now I have a new error. The compiler says: [ERROR] /root/Documents/MavenExamples/abud/src/main/java/com/tecnisys/App.java:[25,2] error: cannot find symbol The code is: package com.tecnisys;
import java.util.*; public class App
{
public static void main( String[] args )
{ System.out.println( "Hello Life!" ); Properties properties = new Properties(); properties.put("metadata.broker.list", "localhost:9092"); properties.put("bootstrap.servers","comma-seperated-list-of-brokers");
properties.put("key.serializer","org.apache.kafka.common.serialization.StringSerializer");// key serializer
properties.put("value.serializer","org.apache.kafka.common.serialization.StringSerializer"); //value serializer
properties.put("acks","1"); //message durability -- 1 mean ack after writing to leader is success. value of "all" means ack after replication. properties.put("security.protocol","SASL_PLAINTEXT"); // Security protocol to use for communication.
properties.put("batch.size","16384");// maximum size of message
KafkaProducer<String,String> producer = new KafkaProducer<String, String>(properties);
}
}
... View more
01-30-2017
01:52 PM
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 ,
... View more
Labels:
- Labels:
-
Apache Kafka