當(dāng)我們初始化java程序時(shí),必須初始化classloader.這個(gè)會與JNDI校驗(yàn)時(shí)非常關(guān)鍵的!當(dāng)Vuser作一個(gè)進(jìn)程時(shí)時(shí)每個(gè)進(jìn)程都會缺省的加載進(jìn)來,這是沒有什么問題的!但是做作為線程,classloader會在main進(jìn)程會加載,但是所有的線程都沒有加載進(jìn)來!所以報(bào)無法使用線程,解決這個(gè)問題,就是我們做一個(gè)假想的類加載動作。
解決方法1:
在腳本初始化前加一句:
DummyClassLoader.setContextClassLoader();
解決方法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();