我在eclipse(Kepler)中創建了動態web項目。在我的應用程序中,我使用了Spring,Hibernate,JSF,JMS & Quartz sheduler。我想要做的是,我想運行一個shedule來發送數據庫值到ActiveMQ
&通過執行MessageListener
來收聽。我的應用程序shedule每5秒發送一次值&它工作正常。但是,在發送15500條消息給ActiveMQ
之後,它引發了以下錯誤。爲什麼會發生這種情況?Java Process Process OutOfMemoryException
Exception in thread "ActiveMQ InactivityMonitor Worker" java.lang.OutOfMemoryError: Java heap space
at java.lang.AbstractStringBuilder.<init>(Unknown Source)
at java.lang.StringBuffer.<init>(Unknown Source)
at org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:194)
at org.slf4j.helpers.MessageFormatter.format(MessageFormatter.java:124)
at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:228)
at org.apache.activemq.transport.AbstractInactivityMonitor$3.run(AbstractInactivityMonitor.java:161)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
異常螺紋:
"org.springframework.jms.listener.DefaultMessageListenerContainer#0-2" java.lang.OutOfMemoryError: Java heap space Exception in thread "DefaultQuartzScheduler_QuartzSchedulerThread" java.lang.OutOfMemoryError: Java heap space
使用分析工具如[YourKit(https://www.yourkit.com/)以確定代碼的哪部分使用您的內存並修復它。 – shan1024