我正在使用MongoDB存儲數據。在我的項目中,我使用線程池將多個用戶(100-2000個用戶)連接到服務器,並將這些用戶的響應存儲在數據庫中。但是當我這樣做時,我得到這個錯誤。請幫我解決一下這個。我無法得到它。我已經浪費了45小時這個錯誤。使用mongodb與java時出錯
錯誤:
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.avaya.onex.hss.requesthandlers.CommandExecutor.executeCommands(CommandExecutor.java:129)
at com.avaya.onex.hss.requesthandlers.CommandExecutor.run(CommandExecutor.java:59)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.mongodb.DBPortPool$SemaphoresOut: Out of semaphores to get db connection
at com.mongodb.DBPortPool.get(DBPortPool.java:176)
at com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:370)
at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:149)
at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:138)
at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:261)
at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:211)
at com.mongodb.DBCollection.insert(DBCollection.java:57)
at com.mongodb.DBCollection.insert(DBCollection.java:102)
at com.avaya.onex.hss.objects.LoginRequest.storeData(LoginRequest.java:152)
at com.avaya.onex.hss.requesthandlers.LoginHandler.handleRequest(LoginHandler.java:20)
... 8 more
com.mongodb.DBPortPool$SemaphoresOut: Out of semaphores to get db connection
at com.mongodb.DBPortPool.get(DBPortPool.java:176)
at com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:370)
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:212)
at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:305)
at com.mongodb.DB.command(DB.java:160)
at com.mongodb.DB.command(DB.java:183)
at com.mongodb.DB.command(DB.java:144)
at com.mongodb.DBCollection.drop(DBCollection.java:777)
at com.mongodb.DBApiLayer$MyCollection.drop(DBApiLayer.java:206)
at com.avaya.onex.hss.requesthandlers.CommandExecutor.executeCommands(CommandExecutor.java:118)
at com.avaya.onex.hss.requesthandlers.CommandExecutor.run(CommandExecutor.java:59)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
你是否檢查過MongoDB源代碼,尤其是'DBPortPool'類? –
不,讓我現在檢查.. – shalki
我只有那個jar文件..在哪個DBPortPool類存在...我怎樣才能讀取java源.. – shalki