当我们初始化java程序时,必须初始化classloader.这个会与JNDI校验时非常关键的!当Vuser作一个进程时时每个进程都会缺省的加载进来,这是没有什么问题的!但是做作为线程,classloader会在main进程会加载,但是所有的线程都没有加载进来!所以报无法使用线程,解决这个问题,就是我们做一个假想的类加载动作。
解决方法1:
在脚本初始化前加一句:
DummyClassLoader.setContextClassLoader();
If you are making calls to JNDI extensions within your script, you may encounter problems trying to run your Vusers as threads. This happens because JNDI requires each thread to have its own context class loader. In order to run as threads, instruct each Vuser to run with its own context class loader, by adding the following line to the beginning of the init section:
DummyClassLoader.setContextClassLoader();