當我們初始化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();