[ 
https://issues.apache.org/jira/browse/KAFKA-1405?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13975828#comment-13975828
 ] 

Vadim Chekan commented on KAFKA-1405:
-------------------------------------

Hi Jun,

Thanks for quick response. 
Seems JSON has been moved out from scala core:
https://github.com/scala/scala-parser-combinators
"As of Scala 2.11, this library is a separate jar that can be omitted from 
Scala projects that do not use Parser Combinators."
"The first 2.11 milestone for which this is true is 2.11.0-M4"

So M3, which you tried, is the last release which has JSON in the core. But 
even if you decide to use "scala-parser-combinators.jar", JSON is deprecated 
there:
https://github.com/scala/scala-parser-combinators/blob/master/src/main/scala/scala/util/parsing/json/JSON.scala#L31

And here is related discussion:
https://groups.google.com/forum/#!topic/scala-internals/axzOQ6fUNQg/discussion
"The JSON classes feel a bit like they were meant as a code example for the 
parser combinator library. Compared to hand-tuned libraries, they seem to be 
too slow for any serious usage."


> Global JSON.globalNumberParser screws up other libraries
> --------------------------------------------------------
>
>                 Key: KAFKA-1405
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1405
>             Project: Kafka
>          Issue Type: Bug
>    Affects Versions: 0.8.0
>            Reporter: Vadim Chekan
>              Labels: json
>
> I'm getting exception "kafka.common.ConsumerRebalanceFailedException" but it 
> only happens when I do a call to "scala/pickling" serialization library. What 
> the connection you might ask? The underly exception is 
> "ZookeeperConsumerConnector:76, exception during rebalance 
> kafka.common.KafkaException: Failed to parse the broker info from zookeeper: 
> {"jmx_port":-1,"timestamp":"1397514497053","host":"xxx","version":1,"port":9092}
> Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to 
> java.lang.Integer"
> A little bit looking at  kafka code lead me to this line:
> In 
> https://github.com/apache/kafka/blob/0.8.0/core/src/main/scala/kafka/utils/Json.scala#L27
> there is JSON.globalNumberParser redefined. It is terrible idea to change 
> global variable. This JSON library is used by other libraries and this global 
> assignment messes it up.
> My 5-minutes research shows that scala's JSON library was considered almost 
> of demo quality and most people prefer ligt-json implementation.
> https://groups.google.com/forum/#!topic/scala-user/P7-8PEUUj6A
> Also it is my understanding, that scala JSON is deprecated in scala-2.11, so 
> this change is needed anyway.
> If no objections to this ticket in general, I can work on a patch to use 3rd 
> party JSON library usage in kafka. Pleas let me know...



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to