我正在学习 Grinder 3.11 来编写我的性能测试脚本。这是我用 Jython 编写的测试脚本:
from java.lang import ClassLoader
from com.fasterxml.jackson.databind import ObjectMapper
from java.net import URL, URLClassLoader
cl = ClassLoader.getSystemClassLoader()
for url in cl.getURLs():
print url.getFile()
class TestRunner:
def __call__(self):
self.test_scenario()
当我使用 Grinder 启动它时,我不断收到以下错误
2015-03-16 11:52:56,783 ERROR krk-mpfxv-16: aborting process - Java exception initialising test script
net.grinder.scriptengine.jython.JythonScriptExecutionException: Java exception initialising test script
from com.fasterxml.jackson.databind import ObjectMapper
File "/Users/mgawinec/projects/grinder-test/src/test/resources/./krk-mpfxv-file-store/current/grinder.py", line 4, in <module>
java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.databind.ObjectMapper
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_05]
at java.lang.Class.forName(Class.java:340) ~[na:1.8.0_05]
当我评论库的导入jackson
并用我得到的其余脚本在类路径中打印罐子时
/Users/xx/projects/grinder-test/src/test/resources/lib/grinder.jar
/Users/xx/projects/grinder-test/src/test/resources/lib/jackson-databind-2.2.3.jar
/Users/xx/projects/grinder-test/src/test/resources/lib/htmlcleaner-2.6.1.jar
/Users/xx/projects/grinder-test/src/test/resources/lib/jackson-core-2.0.0.jar
/Users/xx/projects/grinder-test/src/test/resources/lib/grinder-dcr-agent-3.11.jar
在仔细检查之后,我可以确认ObjectMapper
该类在jackson-databind-2.2.3.jar
.
我在 Jython/Grinder 组合中的其他外部库没有这样的问题。
我怎样才能找到问题的根本原因?