1

I created dynamic web project in eclipse(Kepler).In my application, I used Spring,Hibernate, JSF,JMS & Quartz sheduler. What I wanted to do is, I want to run a shedule to send database values to ActiveMQ & listen by implementing MessageListener. My app shedule to send values every 5 seconds & it works fine. But after sending 15500 messages to the ActiveMQ, It raised following error. Any reason why this can happen?

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)

Exception in thread:

"org.springframework.jms.listener.DefaultMessageListenerContainer#0-2" java.lang.OutOfMemoryError: Java heap space Exception in thread "DefaultQuartzScheduler_QuartzSchedulerThread" java.lang.OutOfMemoryError: Java heap space

1
  • Use a profiling tool like YourKit to identify what part of the code uses your memory and fix it. Commented Sep 10, 2015 at 5:10

1 Answer 1

0

Make sure your code doesn't cause memory leaks. For example, open resources should be closed after usage.

You can use profiling tools like visualvm (bundled with JDK) and Yourkit (commercial) to identify memory issues.

You can also try to increase Java heap size:

-Xms<size>        initial Java heap size
-Xmx<size>        maximum Java heap size

For example:

java -Xms512m -Xmx2g
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.