Solved

Tomcat - setenv.bat

Posted on 2013-05-13
6
3,449 Views
Last Modified: 2013-05-14
I have deployed an application in Tomcat which results in the below error when server starts.

java.land.OutOfMemoryError: GC Overhead limit exceeded

I create a setenv.bat file in bin directory of Tomcat with the following

set JAVA_OPTS=-Xms1024m -Xmx2048m -XX:MaxPermSize=512m
exit /b 0

but this does not help.

Is there a way to find out if the file is getting called and JAVA_OPTS getting set? The documentation of the war file says that this much memory should be sufficient, so I feel it may not even be getting set.

Thank you
0
Comment
Question by:ank5
6 Comments
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
You can set that at the command line yourself and then start Tomcat, but it must be said that if you have a fundamental memory leak in your app, it probably doesn't matter how large you set the heap - you'll still run out off memory
0
 
LVL 12

Expert Comment

by:basav_com
Comment Utility
Use jvisualvm or anyother profiling tool and see how much memory your application is taking up..
0
 
LVL 1

Author Comment

by:ank5
Comment Utility
Thanks for your reply.

This is a war file which is shipped as a part of the product so I think there wouldn't be memory leaks in the app. Also, I have not yet started using the application, restart just after deployment results in this problem.

I'm starting the Tomcat instance from Wndows Services and not through command prompt. Will setting JAVA_OPTS through command prompt still have a effect?
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 20

Expert Comment

by:Amitkumar Panchal
Comment Utility
it may possible that setenv.bat file is not called by catalina.bat.

Check by setting JAVA_OPTS variable in catalina.bat.
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Will setting JAVA_OPTS through command prompt still have a effect?
Yes

Don't forget to stop the service instance first
0
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
Comment Utility
If Tomcat was installed as a service via the installer, you should be able to configure these setting from the service wrapper's property pages. If you have a "Tomcat" folder in your Start Menu->Programs that contains the "Configure Tomcat" shortcut, then check out the screen shot below. Note, the initial and max memory sizes can be set in their own dedicated textbox but the MaxPermSize can just be set in the "Java Options" area.

"Configure Tomcat" screenshot
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Most of the developers using Tomcat find it easy to configure the datasource in Server.xml and use the JNDI name in the code to get the connection.  So the default connection pool using DBCP (or any other framework) is made available and the life go…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now