i am running tomcat 7.0.33 on windows server 2008 R2
(i installed tomcat as windows service)
JDK version: jdk1.6.0_25 64-bit
Tomcat options:
Java Virtual Machine: C:\Program Files\Java\jre6\bin\server\jvm.dll
(BTW, i don't have client folder inside jre)
Initial memory pool: 1000 MB
Maximum memory pool: 2000 MB
when i check the server status, i can see that the server is using
the memory i configured.
Environment Variables (SYSTEM VARIABLES) Configuration:
JAVA_HOME: C:\Program Files\Java\jdk1.6.0_25
Path: ...;%JAVA_HOME%\bin;....
do i need to add CATALINA_HOME and JAVA_OPTS system variables too ?
ISSUE: i have two web applications APP1,*APP2*
when i deploy each one separately, i can find that memory use for
APP1= 198 MB
APP2= 104 MB
Information about the applications:
APP1,APP2: Spring Maven applications that includes in the libraries other small maven spring applications.
APP1: contains webservices, that APP2 uses them.
if i tried to deploy both of them on same tomcat instance, i always get
java.lang.OutOfMemoryError: PermGen space
please advise what might be causing this issue.
the solution was beside setting initial & maximum memory pool, is to add -XX:MaxPermSize=1000m to the java options in the java tab.
You probably need to set/increase the MaxPermSize setting for your Tomcat instance. Note that the MAVEN_OPTS have nothing to do with Tomcat, those are options for the Maven command-line process (mvn). The fact that your application is a "maven" application means nothing at run-time as Maven is not involved in the running of your application, only the building of it.
In the \bin folder in your tomcat installation, there should be an application called "tomcat7.exe". You can use this to update the settings for your tomcat service.
Try something like
tomcat7.exe //US//[name of your tomcat service] --JvmOptions=-Xmx2g
-Xms1g -XX:MaxPermSize=512m
Edit: above statement should be on one line, not two...
I had a similar problem as our app run on Tomcat without problems when Tomcat run standalone and we kept getting permgen out of memory exceptions when running Tomcat as a service.
I found a solution simillar to the one of Pap. You need to access the Tomcat service configuration GUI by running bin/tomcat7w.exe //ES//name_of_service. There you go to the Java tab and set respective java properties directly - e.g.
-XX:MaxPermSize=1000m
Here is a blog post which helped me a lot explaining what all Tomcat settings are ignored by Tomcat when running as a service.
http://www.12robots.com/index.cfm/2010/10/8/Giving-more-memory-to-the-Tomcat-Service-in-Windows
You need to increase PermGen space. Add something like -XX:MaxPermSize=128m to your parameters (you can reserve more perm gen space if you want to). The -Xmx and -Xms settings are for heap whereas here you're running out of PermGen space which is administered separately.
Related
I am trying to run the sonar scanner on a docker virtual machine as part of my private Azure DevOps build server and am getting an error with the pagefile not having enough memory to complete the analysis. My docker image is running windows server core 2019 base image with JDK 11.0.13 installed and Sonarqube scanner 5.0.0. The server also has the following environment variables set to try and increase the Java VM size:
JAVA_OPTS="-Xms1024m -Xmx4608m"
SONAR_SCANNER_OPTS="-Xmx4608m"
My image is running with 5GB RAM and monitoring the container is showing that there is plenty of memory still available to use. I have noticed that the first time I run the scan after starting the container it runs fine but each attempt afterwards gets the error:
##[error]Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000789c00000, 703594496, 0) failed; error='The paging file is too small for this operation to complete' (DOS error/errno=1455)
Can someone please help me with why it is failing to allocate around 700MB when there is more than 2GB RAM available.
The versions of everything are:
Azure DevOps agents: 2.194.0
JDK: 11.0.13
Sonarqube scanner extension: 5.0.0
Docker: 20.10.7
Docker base image: dotnet/framework/sdk:4.8-gbt-windowsservercore-ltsc2019
The issue turned out to be related to the JavaXmlSensor detecting some very large xml test files in the test project, it was trying to load them into memory and analyse them causing the out of memory error.
To fix it I added **/*.xml to the sonar.exclusions and also added the same list of exclusions to the sonar.test.exclusions setting.
I am a newbie on Liferay and furthermore 100% Windows infrastructure knowledge based. I installed Liferay 6.2 on my Windows 2012R2 server together with Java jdk-8u5 version. All is running perfect as long as I am logged in as user on the Server via remotedesktop having open the tomcat startup.bat window.
What have I to do exactly to start Liferay and/or tomcat as service?
Thanks in advance for your efforts.
Configuring liferay or tomcat to run as a service on a windows server doesn't differ that much.So in order to do that you have to add some files to the LIFERAY_HOME\tomcat\bin directory.
To get those files you have to download a full version of 64-bitWindows tomcat from here :
http://tomcat.apache.org/download-70.cgi.
Extract the zip and go to the bin directory, copy service.bat , tomcat7.exe and tomcat7w.exe to this location : LIFERAY_HOME\tomcat\bin
Setting Up the service
Open the commad prompt (Make sure you have admin rights or run the command prompt as administrator),In Command Prompt go to LIFERAY_HOME\tomcat\bin and Execute the following command
service.bat install tomcat7
This will install the tomcat6 service in windows.
Now execute following commond to setup additional configuration for the service
tomcat7w.exe ES tomcat7.exe
2 . Extra configuration :
-XX:MaxPermSize=512m
-Dfile.encoding=UTF8
-Duser.timezone=GMT
-Djava.security.auth.login.config="%CATALINA_HOME%/conf/jaas.config"
-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false
and make sure to provide enough memory for your service by setting the initial memory pool and the maximum one.
Either go with Rafik Beldi's answer (quite an effort, wow) or just go to tomcat's documentation in case you're still missing some information
I had to delete what was in Java Options completely or it wouldn't start: and then I entered:
-XX:MaxPermSize=512m
-Dfile.encoding=UTF8
-Duser.timezone=America/New_York
-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false
-Djava.net.preferIPv4Stack=true
note that where I am: America/New_York allows for both EST and EDT
I am in a situation where I have to deploy two war files in my tomcat . Using
tomcat.apache.org/download-70.cgi#7.0.50
I have a windows server 2003 machine with 3GB RAM. setenv.bat configuration is
set JAVA_OPTS=-XX:MaxPermSize=1024m -Xms256M -Xmx2048M %JAVA_OPTS%
Now,
What works:
When running tomcat with startup.bat. Everything runs fine the way I want.
What does not work :
I installed tomcat as a service. Made same configurations in Tomcat7w.exe . But was will not deploy , on deploying second war stage it just stucks. No errors at all.
Also, when I run tomcat as a service without war files, it runs successfully.
Can anyone please help me out.
Thanks
Arvind
I do not post many questions but I get to the answers by myslef. Should have tried more and then post here. Thank you guys if you are looking out for a solution. I fixed it by changing memory setting. I had to do a number of tests on these memory settings and finally one of them worked.
So for this deployment I kept 1024MB for XMx and perm size of 412 MB and it worked.
Cheers!
I have a really basic play! app which simply handles a couple of normal GET and POST requests and talks to a MySQL database, nothing fancy.
I ran play dist and transferred the zip file to my EC2 instance. After unzipping it, going to the bin folder and running ./myapp, I get a message:
Java HotSpot(TM) 64-Bit Server VM warning: Info: os::commit_memory ... error='Cannot allocate memory' (errorno=12)
There is insufficient memory for the Java Runtime Environment to continue.
I'm running Play version 2.2.1 and this instance has about 512MB of ram, with the 64-bit version of the Oracle JDK. Is this not enough to run a play! app or am I missing something?
Thanks.
Play Framework 2.3 now has a nifty little feature.
$ /path/to/bin/<project-name> -mem 512 -J-server
Shoule get the job done.
Read http://www.playframework.com/documentation/2.3-SNAPSHOT/ProductionConfiguration
Specifying additional JVM arguments
You can specify any JVM arguments to the start script. Otherwise the default JVM settings will be used:
$ /path/to/bin/ -J-Xms128M -J-Xmx512m -J-server
As a convenience you can also set memory min, max, permgen and the reserved code cache size in one go; a formula is used to
determine these values given the supplied parameter (which represents maximum memory):
$ /path/to/bin/ -mem 512 -J-server
Using play 2.2.1 I had to run play dist to generate the zip file. Then I copied that to the aws instance.
Once there, I extracted the zip and changed the executable file:
from:
local mem=${1:-1024}
to:
local mem=${1:-512}
That did it for me. I got the idea from here but I didn't want to just delete the logic they had there, so I just reduced the default value.
Also please note that on aws ec2 micro:
$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.14) (amazon-65.1.11.14.57.amzn1-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
So you have to use the same Java JDK when runnin play dist.
EDIT:
I updated java to openjdk 7 and was able to run the sample play applications without any errors.
I'm unable to find an option to setup remote debugging in JBossWeb 2.1.4 on Windows. It is not installed as a service and there are no .bat scripts where I can edit the JAVA_OPTS environment variable to include:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4142
The only thing in the jboss web bin directory are jbossweb.exe files.
I've tried editing the run configuration in eclipse to start the container by running jbossweb.exe and setting the environment variable JAVA_OPTS to the above, but it doesn't listen on port 4142 on startup (ie, there seems to be no effect in adding the environment variable to the run configuration).
Any ideas here?
If you control the server from eclipse with for instance JBoss Tools, you can just click "debug" instead of "start" in the Server pane in order to start up in debug mode.
You can create such bat script by yourself. Just add jboss.bat file to bin subdirectory of JBoss install directory and put there:
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4142 -jar "D:\JBoss.org\JBoss Web 2.1\bin\bootstrap.jar" start
When you run this script, you will get JBoss running in debug mode. Probably, it won't help you in all situations, but it worked for me.