java.lang.NoClassDefFoundError:org / apache / commons / httpclient / Credentials error

时间:2015-06-28 07:43:22

标签: java fitnesse fitnesse-slim

我已经开始fitnesse rest api testing了。我只有3天大了。我可以在localhost 80上运行。但它对我来说几乎没有错误,缺少jar个文件。

我仍然遇到错误。

我添加的jar列表:

  1. httpclient-4.0.jar
  2. log4j-1.2.16.jar
  3. slf4j-api-1.7.12.jar
  4. slf4j-simple-1.7.12.jar
  5. smartrics-RestClient-2.1.jar
  6. xstream-1.4.8.jar
  7. xuggle-xuggler-5.4.jar
  8. __EXCEPTION__:java.lang.NoClassDefFoundError: org/apache/commons/httpclient/Credentials at smartrics.rest.fitnesse.fixture.PartsFactory.buildRestClient(PartsFactory.java:61) [smartrics-RestFixture-4.0.jar] at smartrics.rest.fitnesse.fixture.RestFixture.configRestClient(RestFixture.java:1167) [smartrics-RestFixture-4.0.jar] at smartrics.rest.fitnesse.fixture.RestFixture.initialize(RestFixture.java:873) [smartrics-RestFixture-4.0.jar] at smartrics.rest.fitnesse.fixture.RestFixture.doTable(RestFixture.java:385) [smartrics-RestFixture-4.0.jar] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.8.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.8.0_45] at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.8.0_45] at fitnesse.slim.fixtureInteraction.DefaultInteraction.methodInvoke(DefaultInteraction.java:80) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.callMethod(MethodExecutor.java:44) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.invokeMethod(MethodExecutor.java:31) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.findAndInvoke(MethodExecutor.java:57) [fitnesse-standalone.jar] at fitnesse.slim.FixtureMethodExecutor.execute(FixtureMethodExecutor.java:20) [fitnesse-standalone.jar] at fitnesse.slim.StatementExecutor.getMethodExecutionResult(StatementExecutor.java:126) [fitnesse-standalone.jar] at fitnesse.slim.StatementExecutor.call(StatementExecutor.java:104) [fitnesse-standalone.jar] at fitnesse.slim.instructions.CallInstruction.executeInternal(CallInstruction.java:35) [fitnesse-standalone.jar] at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor.execute(ListExecutor.java:83) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:84) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:77) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:56) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.serve(SlimServer.java:42) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.handle(SlimService.java:186) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.acceptOne(SlimService.java:194) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.accept(SlimService.java:156) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.startWithFactory(SlimService.java:77) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.main(SlimService.java:57) [fitnesse-standalone.jar] Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.Credentials at java.net.URLClassLoader.findClass(Unknown Source) [rt.jar:1.8.0_45] at java.lang.ClassLoader.loadClass(Unknown Source) [rt.jar:1.8.0_45] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) [rt.jar:1.8.0_45] at java.lang.ClassLoader.loadClass(Unknown Source) [rt.jar:1.8.0_45] at smartrics.rest.fitnesse.fixture.PartsFactory.buildRestClient(PartsFactory.java:61) [smartrics-RestFixture-4.0.jar] at smartrics.rest.fitnesse.fixture.RestFixture.configRestClient(RestFixture.java:1167) [smartrics-RestFixture-4.0.jar] at smartrics.rest.fitnesse.fixture.RestFixture.initialize(RestFixture.java:873) [smartrics-RestFixture-4.0.jar] at smartrics.rest.fitnesse.fixture.RestFixture.doTable(RestFixture.java:385) [smartrics-RestFixture-4.0.jar] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.8.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.8.0_45] at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.8.0_45] at fitnesse.slim.fixtureInteraction.DefaultInteraction.methodInvoke(DefaultInteraction.java:80) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.callMethod(MethodExecutor.java:44) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.invokeMethod(MethodExecutor.java:31) [fitnesse-standalone.jar] at fitnesse.slim.MethodExecutor.findAndInvoke(MethodExecutor.java:57) [fitnesse-standalone.jar] at fitnesse.slim.FixtureMethodExecutor.execute(FixtureMethodExecutor.java:20) [fitnesse-standalone.jar] at fitnesse.slim.StatementExecutor.getMethodExecutionResult(StatementExecutor.java:126) [fitnesse-standalone.jar] at fitnesse.slim.StatementExecutor.call(StatementExecutor.java:104) [fitnesse-standalone.jar] at fitnesse.slim.instructions.CallInstruction.executeInternal(CallInstruction.java:35) [fitnesse-standalone.jar] at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43) [fitnesse-standalone.jar] at fitnesse.slim.ListExecutor.execute(ListExecutor.java:83) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:84) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:77) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:56) [fitnesse-standalone.jar] at fitnesse.slim.SlimServer.serve(SlimServer.java:42) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.handle(SlimService.java:186) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.acceptOne(SlimService.java:194) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.accept(SlimService.java:156) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.startWithFactory(SlimService.java:77) [fitnesse-standalone.jar] at fitnesse.slim.SlimService.main(SlimService.java:57) [fitnesse-standalone.jar]

1 个答案:

答案 0 :(得分:0)

RestFixture依赖于 - 它与被测系统的HTTP交互 - 在RestClient(https://github.com/smartrics/RestClient)上,而这依赖于Apache HTTP Client 3.1(http://hc.apache.org/httpclient-3.x/)。

您看到的异常是由于已添加到您的类路径" Started by user pogi Building in workspace /var/lib/jenkins/jobs/test remote commad/workspace [workspace] $ /bin/sh -xe /tmp/hudson6957625423493115568.sh + ssh pogi@jenkinsbox /home/paops/test.sh Host key verification failed. Build step 'Execute shell' marked build as failure Finished: FAILURE " (它不包含缺失的类)。

您可以通过添加RestFixture包httpclient-4.0.jar中提供的所有jar来解决问题(并避免任何其他类未找到问题),例如可从http://repo1.maven.org/maven2/smartrics/restfixture/smartrics-RestFixture/4.0/

获取