On Jan 23, 2014, at 7:43 AM, Randeep <randeep...@gmail.com> wrote:

> Hi,
> 
> I'm getting out of memory exception errors.
> 
> Exception in thread "Timer-1" java.lang.OutOfMemoryError: Java heap space
>        at java.util.Arrays.copyOf(Arrays.java:2882)
>        at
> java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
>        at
> java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:572)
>        at java.lang.StringBuffer.append(StringBuffer.java:320)
>        at org.json.JSONArray.toString(JSONArray.java:834)
>        at org.json.JSONObject.valueToString(JSONObject.java:1359)
>        at org.json.JSONObject.toString(JSONObject.java:1233)
>        at com.xxx.xxx.servlet.WServlet.writeProgramJson(WServlet.java:503)
>        at com.xxx.xxx.servlet.WServlet$1.run(WServlet.java:414)
>        at java.util.TimerThread.mainLoop(Timer.java:512)
>        at java.util.TimerThread.run(Timer.java:462)
> 
> Is there anyway to see currently set jvm heap size details? Any linux
> commands.

If you run “ps” and “grep” for something like “java”, “catalina”, etc.. you can 
find your running Tomcat process.  On Linux this should show the full command 
that was run.

Alternatively, you could use “jinfo <pid>”.  That will dump a bunch of info 
including the VM Flags.

> 
> I have tried creating setenv.sh and putting the new parameters in it. but
> echo $JAVA_OPTS was not giving any value.

How did you install Tomcat?  Did you use your distro’s package manager?  Did 
you download from tomcat.apache.org?

How are you starting your server?  Are you using the included start script?  
Are you using an init.d (or other) script you created?  Are you using commons 
daemon?

> So I have put in .bash_profile and run it.

Don’t do that.  Why would you want these in your bash profile?

> Then restarted tomcat6.

What version exactly?  There are quite a few.

> this is the line I added in .bash_profile.
> JAVA_OPTS="-Xms256m -Xmx512m -Xss512k -verbose:gc -Xloggc:heap.log”

Again, don’t put this in your profile.

> Also I checked in heap.log where catelina.out can be found. But its not
> created. Then I touched and restarted. But that also didn't work.
> 
> What is the right way to do this?

If you downloaded from tomcat.apache.org and installed from the zip, you’d put 
them in bin/setenv.sh and it would work.  If you’re using a packaged version of 
Tomcat from your Linux distro, then it may well be different.  If you gave more 
details, perhaps someone on the list could help.

Dan

> 
> -- 
> Randeep
> Mob: +919447831699[kerala]
> Mob: +919880050349[B'lore]
> I blog here:
> http://www.randeeppr.me/
> Follow me Here:
> http://twitter.com/Randeeppr
> Poke me here!
> http://www.facebook.com/Randeeppr
> A little Linux Help
> http://www.linuxhelp.in/
> Work profile:
> http://in.linkedin.com/in/randeeppr


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to