准备给scala项目引入单元测试

<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.10</artifactId>
<version>2.2.6</version>
</dependency>
Scala版本: 2.10.4

编译的时候遇到了下面的错误:

Error:scalac: error while loading Suite, Scala signature Suite has wrong version  expected: 5.0  found: 4.1 in Suite.class

一开始猜错是scalatest的版本不对,换了几个版本都还是遇到一样的错误,认真阅读错误信息后恍然大悟!

应该是编译环境的版本不对,我原来安装的scala版本是2.10.4,升级到1.11.7后没有这个错误了,但却出现了另外一个错误:

can't expand macros compiled by previous versions of Scala

意思应该是说不能展开以前版本scala编译的宏

把相应的scalatest编译的版本升级一下:scalatest_2.10 -> scalatest_2.11

最终的配置:

<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.11</artifactId>
<version>2.2.6</version>
<scope>test</scope>
</dependency>
Scala版本: 2.11.7

用2.11.7版本的scala编译没有问题了,但是在提交到spark运行的过程中发现有错误,我的spark用的是官方的基于scala2.10.4编译的2.5.1。

java.lang.NoSuchMethodError: scala.Predef$.$conforms()Lscala/Predef$$less$colon$less;

如果想要要用2.11.7版本的scala来编译你的spark app的话

在服务器上就必须自己用对应版本scala重新编译spark!!!

为了偷懒继续折腾~

把scala SDK降级到2.10.6,并把scalatest降级到相应的版本

最最终的配置:

<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.10</artifactId>
<version>2.2.6</version>
<scope>test</scope>
</dependency>
Scala版本: 2.10.6

最后,终于可以正常编译和运行scalatest了,并且编译的二进制可以在spark上运行起来了。

Scala Error: error while loading Suite, Scala signature Suite has wrong version expected: 5.0 found: 4.1 in Suite.class的更多相关文章

  1. IDEA里运行代码时出现Error:scalac: error while loading JUnit4, Scala signature JUnit4 has wrong version expected: 5.0 found: 4.1 in JUnit4.class错误的解决办法(图文详解)

    不多说,直接上干货!  问题详情 当出现这类错误时是由于版本不匹配造成的 Information:// : - Compilation completed with errors and warnin ...

  2. Selenium2学习-041-chromedriver:org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status from unexpected alert open

    今天在写WebDriver处理弹出框(alert.confirm.prompt)演示实例脚本分发给朋友时,在其执行时未能成功执行,对应的部分错误详情如下: org.openqa.selenium.We ...

  3. IDEA里运行程序时出现Error:scalac:error while loading JUnit4 , Scala signature JUnit4 has wrong version错误的解决办法(图文详解)

    不多说,直接上干货! 问题详情 当我们在运行程序时,出现Error:scalac:error while loading JUnit4 , Scala signature JUnit4 has wro ...

  4. [ERROR] error: error while loading <root>, error in opening zip file error: scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found.

    在家编译一个Apache的开源项目,在编译时遇到错误如下: error: error while loading <root>, error in opening zip file [ER ...

  5. Scala Java Error: value filter is not a member of *

    有时在Scala中调用Java的库,Java库会返回某些Java的集合或类型,必须经过一些转换才能正常使用. 否则有可能在编译的过程遇到这个错误. 错误字符串 下面是错误的主要信息. Scala Ja ...

  6. idea 运行scala代码 报错:Exception in thread "main" java.lang.NoClassDefFoundError: scala/Predef$ java.lang.NoClassDefFoundError: scala/Function0 Error: A JNI error has occurred, please check your installati

    各种报错信息如下: java.lang.NoClassDefFoundError: scala/Function0 at java.lang.Class.getDeclaredMethods0(Nat ...

  7. Error:scalac: Error: org.jetbrains.jps.incremental.scala.remote.ServerException

    Error:scalac: Error: org.jetbrains.jps.incremental.scala.remote.ServerException reason:JDK与Scala的版本不 ...

  8. 有关Error during sbt execution: No Scala version specified or detected的解决方案--SBT

    sbt 全称为 Simple Build Tool,是 Scala 项目中的标准构建工具,类似于 Java 下的 Maven/Groovy 中的 Gradle. 项目的构建 项目依赖自动化管理 提供统 ...

  9. Ubuntu14.04: Error found when loading /root/.profile

    问题描述: 启用root账号登录后系统出现如下提示信息: Error found when loading /root/.profile stdin:is not a tty 解决方法: 在终端中用命 ...

随机推荐

  1. 使用std::function 把类成员函数指针转换为普通函数指针

    前言 这是改造前一篇 设计模式 的基础,使通知者不必知道观察者的类名和函数名,只需要知道更新函数的原型即可. 开发环境:WIN7 32位 + VS2010 发现在VS2005中使用std::funti ...

  2. JQuery笔记:JQuery和JavaScript的联系与区别

    来源:http://www.ido321.com/1019.html ps:LZ觉得这个标题有点大了,超出了能力范围,不喜勿碰.目前只记录LZ能力范围内的,日后持续补充. 一.JQuery对象和DOM ...

  3. exists与in的使用与区别

    1.in的使用举例 select * from tableA where id in (select id from tableB) 2.exists的使用举例 select * from table ...

  4. 自定义Camera综述(一般步骤、注意事项、遇到的难题<【内存溢出问题】>、像素参考)

    一般步骤: 1. 检查和访问Camera:创建代码来检查Camera和所申请访问的存在性: 2. 创建一个预览类:继承SurfaceView来创建一个Camera的预览类,并实现SurfaceHold ...

  5. leetcode—sqrt

    1.题目描述   Implement int sqrt(int x).   Compute and return the square root of x. 2.解法分析 很明显,用二分搜索可解,但是 ...

  6. Hadoop异常处理 Bad connect ack with firstBadLink (No route to host )

    [root@Node1 ~]# hdfs dfs -put /home/test.txt /lab/input15/04/15 17:29:44 INFO hdfs.DFSClient: Except ...

  7. Orchard源码分析(1):插件式的支持——模块和主题

    在Orchard,模块和主题都是可以插拔式的,在源码处理时,用类型(参考:DefaultExtensionTypes)区分,都没太大的本质区别,以下都称做模块. 插件的支持,实现分以下几步: 搜集模块 ...

  8. USACO 2013 November Contest Gold 简要题解

    Problem 1. Empty Stalls 扫两遍即可. Problem 2. Line of Sight 我们发现能互相看见的一对点一定能同时看见粮仓的某一段.于是转换成有n段线段,问有多少对线 ...

  9. PhoneGap搭建运行环境(3.2版本)

    一. 1.准备环境nodejs(http://nodejs.org/download/) 2.ant(http://ant.apache.org/bindownload.cgi) 3.Android ...

  10. Spring Object/XML mapping example

    In this tutorial, we will extend last Maven + Spring hello world example by adding JDBC support, to ...