guardian / content-api-scala-client

A Scala client library for the Guardian's Content API
Apache License 2.0
40 stars 16 forks source link

MappingException with Oracle JDK 1.8 #63

Closed janua closed 9 years ago

janua commented 9 years ago
rg.json4s.package$MappingException: unknown error
    at org.json4s.Extraction$.extract(Extraction.scala:46) ~[json4s-core_2.11-3.2.11.jar:3.2.11]
    at org.json4s.ExtractableJsonAstNode.extract(ExtractableJsonAstNode.scala:21) ~[json4s-core_2.11-3.2.11.jar:3.2.11]
    at com.gu.contentapi.client.parser.JsonParser$.parseSearch(JsonParser.scala:18) ~[content-api-client_2.11-5.0.jar:5.0]
Caused by: scala.tools.scalap.scalax.rules.ScalaSigParserError: Unexpected error: Not a valid class file
    at scala.tools.scalap.scalax.rules.Rules$$anonfun$expect$1.apply(Rules.scala:76) ~[scalap-2.11.1.jar:na]
    at scala.tools.scalap.scalax.rules.scalasig.ClassFileParser$.parse(ClassFileParser.scala:97) ~[scalap-2.11.1.jar:na]
    at org.json4s.reflect.ScalaSigReader$.parseClassFileFromByteCode(ScalaSigReader.scala:150) ~[json4s-core_2.11-3.2.11.jar:3.2.11]
2015-01-20 01:02:31,922 [play-akka.actor.default-dispatcher-24] ERROR frontpress.ToolPressQueueWorker$ - Error processing message MessageId(0b447aa0-9e2c-45f1-b02a-3990c95240e9)
org.json4s.package$MappingException: unknown error
    at org.json4s.Extraction$.extract(Extraction.scala:46) ~[json4s-core_2.11-3.2.11.jar:3.2.11]
    at org.json4s.ExtractableJsonAstNode.extract(ExtractableJsonAstNode.scala:21) ~[json4s-core_2.11-3.2.11.jar:3.2.11]
    at com.gu.contentapi.client.parser.JsonParser$.parseSearch(JsonParser.scala:18) ~[content-api-client_2.11-5.0.jar:5.0]
Caused by: scala.tools.scalap.scalax.rules.ScalaSigParserError: Unexpected error: Not a valid class file
    at scala.tools.scalap.scalax.rules.Rules$$anonfun$expect$1.apply(Rules.scala:76) ~[scalap-2.11.1.jar:na]
    at scala.tools.scalap.scalax.rules.scalasig.ClassFileParser$.parse(ClassFileParser.scala:97) ~[scalap-2.11.1.jar:na]
    at org.json4s.reflect.ScalaSigReader$.parseClassFileFromByteCode(ScalaSigReader.scala:150) ~[json4s-core_2.11-3.2.11.jar:3.2.11]

https://github.com/lift/framework/issues/1632

https://github.com/novus/salat/issues/133

Downgrading fixes the issue.

cb372 commented 9 years ago

Sorry for the slow response.

Do you have some sample code to reproduce this? What is the exact version of the JDK you used? I just tried the client using the following Java version, and it seemed to work fine.

java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
cb372 commented 9 years ago

I have seen this happen very occasionally with 1.8.0_31. Apparently it is fixed in 1.8.0_40.

https://github.com/json4s/json4s/issues/216

janua commented 9 years ago

@cb372 Sorry, I didn't see the first message.

I think this was happening during compilation for me, so I don't really have any sample code. Going to 1.8.0_40 also fixed it for me.

cb372 commented 9 years ago

OK, I'll go ahead and close this.