Kafka消费消息时,报错Error processing message, stopping consumer: (kafka.tools.ConsoleConsumer$)

  • Post author:
  • Post category:其他


问题:

Kafka消费消息时,报错

Error processing message, stopping consumer: (kafka.tools.ConsoleConsumer



)

j

a

v

a

.

l

a

n

g

.

I

l

l

e

g

a

l

A

r

g

u

m

e

n

t

E

x

c

e

p

t

i

o

n

a

t

j

a

v

a

.

n

i

o

.

B

u

f

f

e

r

.

l

i

m

i

t

(

B

u

f

f

e

r

.

j

a

v

a

:

267

)

a

t

k

a

f

k

a

.

m

e

s

s

a

g

e

.

M

e

s

s

a

g

e

.

s

l

i

c

e

D

e

l

i

m

i

t

e

d

(

M

e

s

s

a

g

e

.

s

c

a

l

a

:

236

)

a

t

k

a

f

k

a

.

m

e

s

s

a

g

e

.

M

e

s

s

a

g

e

.

k

e

y

(

M

e

s

s

a

g

e

.

s

c

a

l

a

:

223

)

a

t

k

a

f

k

a

.

m

e

s

s

a

g

e

.

M

e

s

s

a

g

e

A

n

d

M

e

t

a

d

a

t

a

.

k

e

y

(

M

e

s

s

a

g

e

A

n

d

M

e

t

a

d

a

t

a

.

s

c

a

l

a

:

30

)

a

t

k

a

f

k

a

.

t

o

o

l

s

.

C

o

n

s

o

l

e

C

o

n

s

u

m

e

r

) java.lang.IllegalArgumentException at java.nio.Buffer.limit(Buffer.java:267) at kafka.message.Message.sliceDelimited(Message.scala:236) at kafka.message.Message.key(Message.scala:223) at kafka.message.MessageAndMetadata.key(MessageAndMetadata.scala:30) at kafka.tools.ConsoleConsumer






)


j


a


v


a


.


l


a


n


g


.


I


l


l


e


g


a


l


A


r


g


u


m


e


n


t


E


x


c


e


p


t


i


o


n


a


t


j


a


v


a


.


n


i


o


.


B


u


f


f


e


r


.


l


i


m


i


t


(


B


u


f


f


e


r


.


j


a


v


a




:








2


6


7


)


a


t


k


a


f


k


a


.


m


e


s


s


a


g


e


.


M


e


s


s


a


g


e


.


s


l


i


c


e


D


e


l


i


m


i


t


e


d


(


M


e


s


s


a


g


e


.


s


c


a


l


a




:








2


3


6


)


a


t


k


a


f


k


a


.


m


e


s


s


a


g


e


.


M


e


s


s


a


g


e


.


k


e


y


(


M


e


s


s


a


g


e


.


s


c


a


l


a




:








2


2


3


)


a


t


k


a


f


k


a


.


m


e


s


s


a


g


e


.


M


e


s


s


a


g


e


A


n


d


M


e


t


a


d


a


t


a


.


k


e


y


(


M


e


s


s


a


g


e


A


n


d


M


e


t


a


d


a


t


a


.


s


c


a


l


a




:








3


0


)


a


t


k


a


f


k


a


.


t


o


o


l


s


.


C


o


n


s


o


l


e


C


o


n


s


u


m


e


r








a

n

o

n

f

u

n

anonfun






a


n


o


n


f


u


n





main



1.

a

p

p

l

y

(

C

o

n

s

o

l

e

C

o

n

s

u

m

e

r

.

s

c

a

l

a

:

168

)

a

t

k

a

f

k

a

.

t

o

o

l

s

.

C

o

n

s

o

l

e

C

o

n

s

u

m

e

r

1.apply(ConsoleConsumer.scala:168) at kafka.tools.ConsoleConsumer






1


.


a


p


p


l


y


(


C


o


n


s


o


l


e


C


o


n


s


u


m


e


r


.


s


c


a


l


a




:








1


6


8


)


a


t


k


a


f


k


a


.


t


o


o


l


s


.


C


o


n


s


o


l


e


C


o


n


s


u


m


e


r








a

n

o

n

f

u

n

anonfun






a


n


o


n


f


u


n





main



1.

a

p

p

l

y

(

C

o

n

s

o

l

e

C

o

n

s

u

m

e

r

.

s

c

a

l

a

:

166

)

a

t

s

c

a

l

a

.

c

o

l

l

e

c

t

i

o

n

.

I

t

e

r

a

t

o

r

1.apply(ConsoleConsumer.scala:166) at scala.collection.Iterator






1


.


a


p


p


l


y


(


C


o


n


s


o


l


e


C


o


n


s


u


m


e


r


.


s


c


a


l


a




:








1


6


6


)


a


t


s


c


a


l


a


.


c


o


l


l


e


c


t


i


o


n


.


I


t


e


r


a


t


o


r





class.foreach(Iterator.scala:727)

at kafka.utils.IteratorTemplate.foreach(IteratorTemplate.scala:32)

at scala.collection.IterableLike



c

l

a

s

s

.

f

o

r

e

a

c

h

(

I

t

e

r

a

b

l

e

L

i

k

e

.

s

c

a

l

a

:

72

)

a

t

k

a

f

k

a

.

c

o

n

s

u

m

e

r

.

K

a

f

k

a

S

t

r

e

a

m

.

f

o

r

e

a

c

h

(

K

a

f

k

a

S

t

r

e

a

m

.

s

c

a

l

a

:

25

)

a

t

k

a

f

k

a

.

t

o

o

l

s

.

C

o

n

s

o

l

e

C

o

n

s

u

m

e

r

class.foreach(IterableLike.scala:72) at kafka.consumer.KafkaStream.foreach(KafkaStream.scala:25) at kafka.tools.ConsoleConsumer






c


l


a


s


s


.


f


o


r


e


a


c


h


(


I


t


e


r


a


b


l


e


L


i


k


e


.


s


c


a


l


a




:








7


2


)


a


t


k


a


f


k


a


.


c


o


n


s


u


m


e


r


.


K


a


f


k


a


S


t


r


e


a


m


.


f


o


r


e


a


c


h


(


K


a


f


k


a


S


t


r


e


a


m


.


s


c


a


l


a




:








2


5


)


a


t


k


a


f


k


a


.


t


o


o


l


s


.


C


o


n


s


o


l


e


C


o


n


s


u


m


e


r





.main(ConsoleConsumer.scala:166)

at kafka.tools.ConsoleConsumer.main(ConsoleConsumer.scala)

Consumed 0 messages

解决方案:

检查代码使用的kafka的jar包是否和集群中的kafka的jar包版本是否一致。

我的是本地代码用的2.11,集群中使用的2.10 导致一接收消息就报错



版权声明:本文为lzw4035原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。