java.lang.ClassNotFoundException:在Intellij 14中运行specs2测试时的IntegrationSpec

时间:2014-11-06 17:56:50

标签: testing intellij-idea classnotfoundexception playframework-2.2 specs2

我做的是:

  1. 安装Intellij 14(同样的问题也出现在Intellij 13中)
  2. 为Intellij安装Scala 1.0插件(支持Scala,SBT,SSP,HOCON和Play 2)。
  3. 创建一个新的Play 2.x项目
  4. 从Intellij 14运行项目(通过localhost:9000成功打开)
  5. 由于下面的错误消息,运行默认测试(ApplicationSpec,IntegrationSpec)将无法运行。
  6. 为什么在运行默认测试时不会生成测试类?

    我的配置有问题(请参阅http://prntscr.com/53nk41http://prntscr.com/53nkj7)?

    感谢您的任何建议!

    错误:

    Testing started at 18:31 ...
    java.lang.ClassNotFoundException: IntegrationSpec
    java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    java.security.AccessController.doPrivileged(Native Method)
    java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    org.specs2.reflect.Classes$class.loadClassOf(Classes.scala:206)
    org.specs2.reflect.Classes$.loadClassOf(Classes.scala:213)
    org.specs2.reflect.Classes$$anonfun$loadClassEither$1.apply(Classes.scala:197)
    org.specs2.reflect.Classes$$anonfun$loadClassEither$1.apply(Classes.scala:197)
    org.specs2.control.Exceptions$class.trye(Exceptions.scala:92)
    org.specs2.control.Exceptions$.trye(Exceptions.scala:108)
    org.specs2.reflect.Classes$class.loadClassEither(Classes.scala:197)
    org.specs2.reflect.Classes$.loadClassEither(Classes.scala:213)
    org.specs2.reflect.Classes$class.tryToCreateObjectEither(Classes.scala:90)
    org.specs2.reflect.Classes$.tryToCreateObjectEither(Classes.scala:213)
    org.specs2.reflect.Classes$class.tryToCreateObject(Classes.scala:70)
    org.specs2.reflect.Classes$.tryToCreateObject(Classes.scala:213)
    org.specs2.specification.SpecificationStructure$$anonfun$createSpecificationOption$1.apply(BaseSpecification.scala:107)
    org.specs2.specification.SpecificationStructure$$anonfun$createSpecificationOption$1.apply(BaseSpecification.scala:107)
    scala.Option.orElse(Option.scala:257)
    org.specs2.specification.SpecificationStructure$.createSpecificationOption(BaseSpecification.scala:107)
    org.specs2.specification.SpecificationStructure$.createSpecification(BaseSpecification.scala:94)
    org.specs2.runner.ClassRunner.createSpecification(ClassRunner.scala:64)
    org.specs2.runner.ClassRunner.start(ClassRunner.scala:35)
    org.specs2.runner.NotifierRunner.start(NotifierRunner.scala:25)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:483)
    org.jetbrains.plugins.scala.testingSupport.specs2.JavaSpecs2Runner.runSingleTest(JavaSpecs2Runner.java:92)
    org.jetbrains.plugins.scala.testingSupport.specs2.JavaSpecs2Runner.main(JavaSpecs2Runner.java:68)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:483)
    com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
    can not create specification: IntegrationSpec
    java.lang.ClassNotFoundException: ApplicationSpec
    java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    java.security.AccessController.doPrivileged(Native Method)
    java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    org.specs2.reflect.Classes$class.loadClassOf(Classes.scala:206)
    org.specs2.reflect.Classes$.loadClassOf(Classes.scala:213)
    org.specs2.reflect.Classes$$anonfun$loadClassEither$1.apply(Classes.scala:197)
    org.specs2.reflect.Classes$$anonfun$loadClassEither$1.apply(Classes.scala:197)
    org.specs2.control.Exceptions$class.trye(Exceptions.scala:92)
    org.specs2.control.Exceptions$.trye(Exceptions.scala:108)
    org.specs2.reflect.Classes$class.loadClassEither(Classes.scala:197)
    org.specs2.reflect.Classes$.loadClassEither(Classes.scala:213)
    org.specs2.reflect.Classes$class.tryToCreateObjectEither(Classes.scala:90)
    org.specs2.reflect.Classes$.tryToCreateObjectEither(Classes.scala:213)
    org.specs2.reflect.Classes$class.tryToCreateObject(Classes.scala:70)
    org.specs2.reflect.Classes$.tryToCreateObject(Classes.scala:213)
    org.specs2.specification.SpecificationStructure$$anonfun$createSpecificationOption$1.apply(BaseSpecification.scala:107)
    org.specs2.specification.SpecificationStructure$$anonfun$createSpecificationOption$1.apply(BaseSpecification.scala:107)
    scala.Option.orElse(Option.scala:257)
    org.specs2.specification.SpecificationStructure$.createSpecificationOption(BaseSpecification.scala:107)
    org.specs2.specification.SpecificationStructure$.createSpecification(BaseSpecification.scala:94)
    org.specs2.runner.ClassRunner.createSpecification(ClassRunner.scala:64)
    org.specs2.runner.ClassRunner.start(ClassRunner.scala:35)
    org.specs2.runner.NotifierRunner.start(NotifierRunner.scala:25)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:483)
    org.jetbrains.plugins.scala.testingSupport.specs2.JavaSpecs2Runner.runSingleTest(JavaSpecs2Runner.java:92)
    org.jetbrains.plugins.scala.testingSupport.specs2.JavaSpecs2Runner.main(JavaSpecs2Runner.java:68)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:483)
    com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
    can not create specification: ApplicationSpec
    Process finished with exit code 0
    

1 个答案:

答案 0 :(得分:1)

自11月21日起,IntelliJ Scala插件的1.1.2版已经解决了这个问题:

https://plugins.jetbrains.com/update/index?pr=&updateId=17896