1

I'm learning Grinder 3.11 to script my performance tests. Here's my test script written in 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()

When I launch it with Grinder I keep getting the following error

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]

When I commented the import for jackson library and printed the jars in classpath with the rest of the script I got

/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

And after double-checking I can confirm that ObjectMapper class is in the right package in the jackson-databind-2.2.3.jar.

I didn't have such problems with other external libraries in Jython/Grinder combination.

How can I find what is the root cause of the problem?

Juan Carlos Farah
  • 3,829
  • 30
  • 42
dzieciou
  • 4,049
  • 8
  • 41
  • 85

1 Answers1

1

This means that ObjectMapper is calling a class that is missing in CLASSPATH.

Karlo Smid
  • 525
  • 1
  • 5
  • 13