编译失败:在 Scala 2.10 下从 Java 8 加载 AnnotatedElement、ConcurrentMap、CharSequence 时出错? [英] Compilation failed: error while loading AnnotatedElement, ConcurrentMap, CharSequence from Java 8 under Scala 2.10?

查看:20
本文介绍了编译失败:在 Scala 2.10 下从 Java 8 加载 AnnotatedElement、ConcurrentMap、CharSequence 时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下内容:

  • Scala 2.10.4
  • Scalatra 2.2.2
  • sbt 0.13.0
  • Java 1.8.0
  • casbah 2.7.2
  • scalatra-sbt 0.3.5

我经常遇到这个错误:

21:32:00.836 [qtp1687101938-55] ERROR o.fusesource.scalate.TemplateEngine - Compilation failed:
error: error while loading CharSequence, class file '/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/rt.jar(java/lang/CharSequence.class)' is broken
(class java.lang.RuntimeException/bad constant pool tag 18 at byte 10)
error: error while loading ConcurrentMap, class file '/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/rt.jar(java/util/concurrent/ConcurrentMap.class)' is broken
(class java.lang.RuntimeException/bad constant pool tag 18 at byte 61)
two errors found
21:38:03.616 [qtp1687101938-56] ERROR o.fusesource.scalate.TemplateEngine - Compilation failed:
error: error while loading AnnotatedElement, class file '/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre/lib/rt.jar(java/lang/reflect/AnnotatedElement.class)' is broken
(class java.lang.RuntimeException/bad constant pool tag 18 at byte 76)
one error found

目前,当我只是尝试在我的 MongoDB 集合上调用 .count() 时遇到了这个问题.

Currently I'm running into this when simply trying to call a .count() on my MongoDB collection.

在谷歌上搜索,它似乎可能是由依赖问题引起的.问题是,我使用 Scalatra 只是为了提供 API,实际上不需要任何 scalate 东西.我注释掉了所有对它的引用,但我仍然得到了这个.这可能是我使用的库之间的依赖问题吗?

Upon Googling, it seems like it may be caused by dependency issues. The thing is, I'm using Scalatra just to serve an API and actually don't require any of the scalate stuff. I commented out all references to it, but I still get this. Could it be a dependency issue between the libraries I'm using?

推荐答案

在我的公司,我们在使用 CharSequence 时遇到了这个问题.这是因为 Scala 2.10.x 不适用于 Java 8.这在 Scalas 邮件列表.切换回 Java 7.

In my company we had this problem with CharSequence. This is due to Scala 2.10.x does not work with Java 8. This was described in Scalas mailinglist. Switch back to Java 7.

这篇关于编译失败:在 Scala 2.10 下从 Java 8 加载 AnnotatedElement、ConcurrentMap、CharSequence 时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆