1

我正在使用 FitNesse Slim 执行一些简单的 POST/GET 请求。我使用 Maven 作为我的依赖管理系统。

当我尝试运行我的 Fixture 时,我收到以下错误消息。

__EXCEPTION__:java.lang.NoClassDefFoundError: org/apache/http/HttpEntity
    at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_76]
    at java.lang.Class.forName(Class.java:191) [rt.jar:1.7.0_76]
    at fitnesse.slim.SlimExecutionContext.getClass(SlimExecutionContext.java:128) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimExecutionContext.searchPathsForClass(SlimExecutionContext.java:118) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimExecutionContext.createInstanceOfConstructor(SlimExecutionContext.java:89) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimExecutionContext.create(SlimExecutionContext.java:43) [fitnesse-20150226.jar]
    at fitnesse.slim.StatementExecutor.create(StatementExecutor.java:77) [fitnesse-20150226.jar]
    at fitnesse.slim.instructions.MakeInstruction.executeInternal(MakeInstruction.java:26) [fitnesse-20150226.jar]
    at fitnesse.slim.instructions.Instruction.execute(Instruction.java:30) [fitnesse-20150226.jar]
    at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49) [fitnesse-20150226.jar]
    at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43) [fitnesse-20150226.jar]
    at fitnesse.slim.ListExecutor.execute(ListExecutor.java:83) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:87) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:80) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:59) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimServer.serve(SlimServer.java:45) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimService.handle(SlimService.java:184) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimService.acceptOne(SlimService.java:192) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimService.accept(SlimService.java:154) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimService.startWithFactory(SlimService.java:75) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimService.main(SlimService.java:56) [fitnesse-20150226.jar]
Caused by: java.lang.ClassNotFoundException: org.apache.http.HttpEntity
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366) [rt.jar:1.7.0_76]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355) [rt.jar:1.7.0_76]
    at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_76]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354) [rt.jar:1.7.0_76]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425) [rt.jar:1.7.0_76]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) [rt.jar:1.7.0_76]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358) [rt.jar:1.7.0_76]
    at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_76]
    at java.lang.Class.forName(Class.java:191) [rt.jar:1.7.0_76]
    at fitnesse.slim.SlimExecutionContext.getClass(SlimExecutionContext.java:128) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimExecutionContext.searchPathsForClass(SlimExecutionContext.java:118) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimExecutionContext.createInstanceOfConstructor(SlimExecutionContext.java:89) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimExecutionContext.create(SlimExecutionContext.java:43) [fitnesse-20150226.jar]
    at fitnesse.slim.StatementExecutor.create(StatementExecutor.java:77) [fitnesse-20150226.jar]
    at fitnesse.slim.instructions.MakeInstruction.executeInternal(MakeInstruction.java:26) [fitnesse-20150226.jar]
    at fitnesse.slim.instructions.Instruction.execute(Instruction.java:30) [fitnesse-20150226.jar]
    at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49) [fitnesse-20150226.jar]
    at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43) [fitnesse-20150226.jar]
    at fitnesse.slim.ListExecutor.execute(ListExecutor.java:83) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:87) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:80) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:59) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimServer.serve(SlimServer.java:45) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimService.handle(SlimService.java:184) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimService.acceptOne(SlimService.java:192) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimService.accept(SlimService.java:154) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimService.startWithFactory(SlimService.java:75) [fitnesse-20150226.jar]
    at fitnesse.slim.SlimService.main(SlimService.java:56) [fitnesse-20150226.jar]

我假设这是因为我没有正确设置 Maven 存储库,以便 FitNesse 可以找到HttpEntity类/jar 文件。

我该怎么做呢?

我的套件 wiki 页面如下所示:

!define TEST_SYSTEM {slim}

!path target/classes
!path /home/foobar/.m2/repository

>FoobarFitnesse

我的测试页面如下所示:

|import  |
|mypackagename|


!|SimpleFoobarFixture                                                                |
|baseUrl                      |appId      |utterance                     |commandName|
|abc.123.com|some-app-id|What is the weather in San Diego|Forecast   |
4

1 回答 1

0

Maven 是本地依赖库,但它与类路径无关。

org.apache.http.HttpEntity在运行时类路径上找不到该类。您需要在运行时类路径上添加一个包含该类的库。

于 2015-03-10T20:47:12.890 回答