JBoss and WMI using Jacob and Java
Question
Has anybody ever had issues with a Java application that uses Jacob to call WMI queries, with that application being deployed to JBoss? JBoss locks up around the WMI calls with no further information available.
Solution
Actually found out it was something to do with Single-Thread Apartments and COM objects. before creating the JACOB call it is important to do an ComThread.initSTA() and then when finished do a ComThread.Release() and ComThread.quitMainSTA(). This should allow for proper multi-threading with COM objects.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow