weird tomcat7 on start - java

My Tomcat 7 Works fine, but when i retrieve the run command, return:
# ps -ef | grep java
tomcat7 18794 1 2 09:30 ? 00:01:09 /usr/lib/jvm/default-java/bin/java
-Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.properties
-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms2048m -Xmx2048m -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed -classpath /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
-Dcatalina.base=/var/lib/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp org.apache.catalina.startup.Bootstrap start root 20085 18341 0 10:13 pts/0 00:00:00 grep java
I can't remove the "-Xmx128m" parameter.
I change this files:
/usr/share/tomcat7/bin/setenv.sh
/usr/share/tomcat7/defaults.template
But the parameter persist.
The xmx & xms are assigned correctly to 2048m, but i want a correct start.

Did you search through this file ? :
/etc/default/tomcat7
Find the line with JAVA_OPTS="-Djava.awt.headless=true
and change the -Xmx128 parameter

Solved!.
Just edit /etc/default/tomca7 and change this line:
JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC"
to this:
JAVA_OPTS="-Djava.awt.headless=true -Xmx2048m -XX:+UseConcMarkSweepGC"

Related

Error: Could not create the Java Virtual Machine. Spigot Minecraft

i'm trying to install spigot server on debian 10, when i run start.sh:
#!/bin/sh
while true
do
java -Xms4G -Xmx4G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -
XX:+UnlockExperimentalVMOptions -$
echo "restarting in 10"
sleep 10
done
i've got this output:
i don't have any idea on how to fix it, any help?
The script seems to require an argument which should be the jar name.
Also, you put a wrong back to break line ("\n") which seems to break the bash.
For me, you should replace -$ by the jar file or spigot, like that:
#!/bin/sh
while true
do
java -Xms4G -Xmx4G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions spigot-1.18.jar
echo "Restarting in 10 seconds"
sleep 10
done
The script is not correct.
#!/bin/sh
while true
do
java -Xms4G -Xmx4G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 - XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar spigot.jar nogui
echo "restarting in 10"
sleep 10
done
Reference: https://www.vultr.com/docs/setup-spigot-on-debian-10/

How to set JVM maximum heap memory for Apache Ignite v1.7?

How do I set the maximum heap memory available to Apache Ignite when running via ignite.sh? The docs do not seem to cover this very basic task. Also, how do I verify that the setting is actually working?
I have read that the command line option -J is available for passing JVM arguments from ignite.sh to the JVM process, but am unable to find evidence it is actually working. For example, if I start Ignite as follows:
bin/ignite.sh -v -J-Xmx2g
The program outputs the following message:
[09:13:42,422][INFO][main][IgniteKernal] VM arguments: [-Xms1g, -Xmx1g, -XX:+AggressiveOpts, -XX:MaxPermSize=256m, -DIGNITE_QUIET=false, -DIGNITE_SUCCESS_FILE=/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin/work/ignite_success_5d0c3958-8952-4a7d-81b0-76c07ae6c520, -Dcom.sun.management.jmxremote, -Dcom.sun.management.jmxremote.port=49164, -Dcom.sun.management.jmxremote.authenticate=false, -Dcom.sun.management.jmxremote.ssl=false, -DIGNITE_HOME=/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin, -DIGNITE_PROG_NAME=bin/ignite.sh, -Xmx2g]
Which seems to suggest both -Xmx1g and -Xmx2g are being passed.
Also, ps aux shows the following:
landon 47582 1.0 2.1 5214944 172616 s000 S+ 9:13AM 0:06.19 /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java -Xms1g -Xmx1g -server -XX:+AggressiveOpts -XX:MaxPermSize=256m -DIGNITE_QUIET=false -Xdock:name=Ignite Node -DIGNITE_SUCCESS_FILE=/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin/work/ignite_success_5d0c3958-8952-4a7d-81b0-76c07ae6c520 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=49164 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -DIGNITE_HOME=/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin -DIGNITE_PROG_NAME=bin/ignite.sh -Xmx2g -cp /Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin/libs/*:/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin/libs/ignite-indexing/*:/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin/libs/ignite-spring/*:/Users/landon/Downloads/apache-ignite-fabric-1.7.0-bin/libs/licenses/* org.apache.ignite.startup.cmdline.CommandLineStartup config/default-config.xml
landon 45624 0.0 0.0 3166752 1292 ?? S Fri07PM 0:00.01 /bin/bash bin/ignite.sh -v -J-Xmx2g
Which ambiguously lists both -Xmx1g and -Xmx2g on the command line.
This is the correct way to set heap memory. If Xmx is listed twice, JVM will use the last one.

Heap and PermGenspace increase in tomcat

I see that tons of questions posted in SO and other sites to increase tomcat memory when outoferror occurs. But none of them looks the same because some of them said use CATALINA_OPTS and some said JAVA_OPTS. and the location mostly they said like bin/setenv.sh if no file created it.
I follow the above things and still could not set the memory correctly as expected.
I have created the setenv.sh file inside bin directory of currently using tomcat.But still heap space is not increased.
CATALINA_OPTS="-Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m -XX:+DisableExplicitGC"
this is my content of setenv.sh and please anyone explain what is the problem here, and whether set or export need to use in setenv.sh.
Can any one guide me for this?
Please try to edit the bin/setenv.sh
export CATALINA_OPTS="-Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m -XX:+DisableExplicitGC"
JAVA_OPTS is passed to all JVM processes running on the same machine.
Use CATALINA_OPTS if you specifically want to pass JVM arguments to Tomcat.
By using the ps -eaf | grep 'tomcat' in the terminal, we can confirm the values.
Eg.,
root 32451 1 99 13:57 pts/1 00:00:07 /usr/java/jdk1.7.0_79/bin/java
-Djava.util.logging.config.file=/opt/apache-tomcat/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m -XX:+DisableExplicitGC
-Djava.endorsed.dirs=/opt/apache-tomcat/endorsed -classpath /opt/apache-tomcat/bin/bootstrap.jar:/opt/apache-tomcat/bin/tomcat-juli.jar
-Dcatalina.base=/opt/apache-tomcat
-Dcatalina.home=/opt/apache-tomcat
-Djava.io.tmpdir=/opt/apache-tomcat/temp org.apache.catalina.startup.Bootstrap start

Jenkins Java VM error when running a Maven test - Unrecognized VM option 'MaxPermSize-128m'

The problem is, we changed that from MaxPermSize-128m to MaxPermSize=128m
but the system keeps giving us that error:
We even restarted Jenkins.
Is it caching something, or there is more than one place where this setting should be changed?
[workspace] $ /usr/lib/jvm/java-6-openjdk-amd64/bin/java -Xmx512m -XX:MaxPermSize-128m -cp /mnt/www/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.3.jar:/mnt/www/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.1.0/boot/plexus-classworlds-2.4.2.jar org.jvnet.hudson.maven3.agent.Maven3Main /mnt/www/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.1.0 /var/cache/jenkins/war/WEB-INF/lib/remoting-2.28.jar /mnt/www/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.3.jar 55896
Unrecognized VM option 'MaxPermSize-128m'
Could not create the Java virtual machine.
ERROR: Failed to launch Maven. Exit code = 1
the output of 'ps -ef | grep java' is:
root 3509 1 0 Jul12 ? 00:07:17 /usr/local/share/elasticsearch/bin/service/exec/elasticsearch-linux-x86-64 /usr/local/share/elasticsearch/bin/service/elasticsearch.conf wrapper.syslog.ident=elasticsearch wrapper.pidfile=/usr/local/share/elasticsearch/bin/service/./elasticsearch.pid wrapper.name=elasticsearch wrapper.displayname=ElasticSearch wrapper.daemonize=TRUE wrapper.statusfile=/usr/local/share/elasticsearch/bin/service/./elasticsearch.status wrapper.java.statusfile=/usr/local/share/elasticsearch/bin/service/./elasticsearch.java.status wrapper.script.version=3.5.14
root 3511 3509 0 Jul12 ? 00:45:11 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java -Delasticsearch-service -Des.path.home=/usr/local/share/elasticsearch -Xss256k -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true -Xms1024m -Xmx1024m -Djava.library.path=/usr/local/share/elasticsearch/bin/service/lib -classpath /usr/local/share/elasticsearch/bin/service/lib/wrapper.jar:/usr/local/share/elasticsearch/lib/elasticsearch-0.19.11.jar:/usr/local/share/elasticsearch/lib/elasticsearch-0.19.11.jar:/usr/local/share/elasticsearch/lib/jna-3.3.0.jar:/usr/local/share/elasticsearch/lib/log4j-1.2.17.jar:/usr/local/share/elasticsearch/lib/lucene-analyzers-3.6.1.jar:/usr/local/share/elasticsearch/lib/lucene-core-3.6.1.jar:/usr/local/share/elasticsearch/lib/lucene-highlighter-3.6.1.jar:/usr/local/share/elasticsearch/lib/lucene-memory-3.6.1.jar:/usr/local/share/elasticsearch/lib/lucene-queries-3.6.1.jar:/usr/local/share/elasticsearch/lib/snappy-java-1.0.4.1.jar:/usr/local/share/elasticsearch/lib/sigar/sigar-1.6.4.jar -Dwrapper.key=b1QUXxfrVfakmb6w -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.disable_console_input=TRUE -Dwrapper.pid=3509 -Dwrapper.version=3.5.14 -Dwrapper.native_library=wrapper -Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp org.elasticsearch.bootstrap.ElasticSearchF
jenkins 20372 1 0 08:17 ? 00:00:00 /usr/bin/daemon --name=jenkins --inherit --env=JENKINS_HOME=/mnt/www/jenkins --output=/var/log/jenkins/jenkins.log --pidfile=/var/run/jenkins/jenkins.pid -- /usr/bin/java -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1
jenkins 20373 20372 23 13:20 ? 00:05:51 /usr/bin/java -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1
root 29403 28220 0 13:45 pts/0 00:00:00 grep --color=auto java
How did you expect to set the maximum to a negative value? I think you wanted
-XX:MaxPermSize=128m
-- Update ---
Ok, so you have fixed this, but the build still fails.
Look into the "workspace cleanup plugin", and if it is not installed, install it and activate it. The workspace cleanup plugin will remove evidence of prior builds from the workspace before launch. Odds are that the configuration is stored to file, and then referenced from file immediately prior to launch.
You could move into the workspace directories and grep for the "minus 128" version of the command and alter it by hand, but by using the plugin you also avoid future similar issues.

Error Expanding Script Generated Classpath for Java in PowerShell Script

Synopsis:
I am trying to convert a shell script from UNIX to Powershell.
The script cannot "hardcode" the path, but must instead list a directory to dynamically build the path at runtime.
Also, the script must pass in 1 parameter to indicate the "type" of the run.
I am placing my "attempted" re-write of the script (after much googling/binging)
This script might be very close as the "echo" statements produced what seems to be correct.
$EXE_CLASS="com.sungard.sims.dacar.standalone.Dacar"
#$DACAR_TAG=%1
$JAVA_EXE="$ENV:JDK15\jre\bin\java"
#JAVA_EXE=\opt\java\bin\java
$JARS="dist\lib\Dacar-Engine.jar;dist\lib\Dacar-Common.jar;dist\lib\Dacar-Collector.jar;dist\lib\standalone-Dacar.jar;dist\lib\DACAR-CRG.jar;"
#dynamically append all .jar files from the jars directory.
ls jars\*.jar | % { $JARS +=";jars\"+ $_.name }
$JAVA_OPTS="-server -Xloggc:.\engine.gc.log -Xmx2048m -Xms2048m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:SurvivorRatio=8 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:MaxTenuringThreshold=8 -XX:CMSInitiatingOccupancyFraction=60 -XX:+PrintGCTimeStamps -XX:MaxPermSize=128m -XX:PermSize=128m -DinstName=${DACAR_TAG} -DprocType=ENGINE"
echo "exe: -> $JAVA_EXE"
echo "opts: -> $JAVA_OPTS"
echo "jars: -> $JARS"
echo "class: -> $EXE_CLASS"
& $JAVA_EXE $JAVA_OPTS "-classpath .\configuration;$JARS $EXE_CLASS 1> dacar.out 2> dacar.err"
please note that I have commented out the use of the DACAR_TAG which would normally be passed in as %1 in batch script containing "TEST|DEV|PROD|QA|STRESS|[CLIENT SPECIFIC VALUE]"
Here is the output:
PS C:\dacar> .\startDacar.ps1
exe: -> c:\Program Files\Java\jdk1.5.0_22\jre\bin\java
opts: -> -server -Xloggc:.\engine.gc.log -Xmx2048m -Xms2048m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:SurvivorRatio=8 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:MaxTe
nuringThreshold=8 -XX:CMSInitiatingOccupancyFraction=60 -XX:+PrintGCTimeStamps -XX:MaxPermSize=128m -XX:PermSize=128m -DinstName=TESTING -DprocType=ENGINE
jars: -> dist\lib\Dacar-Engine.jar;dist\lib\Dacar-Common.jar;dist\lib\Dacar-Collector.jar;dist\lib\standalone-Dacar.jar;dist\lib\DACAR-CRG.jar;;jars\activation.jar;jars
\commons-beanutils-1.6.jar;jars\commons-codec-1.3.jar;jars\commons-collections-3.2.jar;jars\commons-configuration-1.4.jar;jars\commons-dbcp-1.4.jar;jars\commons-digester
-1.6.jar;jars\commons-discovery-0.4.jar;jars\commons-id.jar;jars\commons-lang-2.2.jar;jars\commons-logging-1.0.3.jar;jars\commons-pool-1.5.4.jar;jars\concurrent.jar;jars
\graphics.jar;jars\ha-javamail-1.0-beta-1.jar;jars\hsqldb.jar;jars\ibatis-core-3.0.jar;jars\jcommon-1.0.6.jar;jars\jconn3.jar;jars\jdom.jar;jars\jetty-6.1.15.jar;jars\je
tty-util-6.1.15.jar;jars\jfreechart-1.0.3.jar;jars\jgroups-all.jar;jars\jmxri.jar;jars\jta.jar;jars\junit.jar;jars\log4j-1.2.9.jar;jars\mailapi.jar;jars\postgresql-8.0.3
09.jdbc2ee.jar;jars\postgresql-8.4-701.jdbc3.jar;jars\quartz-1.6.0.jar;jars\servlet-api-2.5-20081211.jar;jars\smtp.jar;jars\svnant.jar;jars\svnClientAdapter.jar;jars\svn
javahl.jar;jars\truezip-6.jar;jars\uic-optional.jar;jars\uic.jar
class: -> com.sungard.sims.dacar.standalone.Dacar
Unrecognized option: -server -Xloggc:.\engine.gc.log -Xmx2048m -Xms2048m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:SurvivorRatio=8 -XX:+UseParNewGC -XX:+UseConcMarkSweepG
-XX:MaxTenuringThreshold=8 -XX:CMSInitiatingOccupancyFraction=60 -XX:+PrintGCTimeStamps -XX:MaxPermSize=128m -XX:PermSize=128m -DinstName=TESTING -DprocType=ENGINE
Could not create the Java virtual machine.
Adding the tag will be my next question if I can't figure this out.
JUST AS AN FYI, from with in a ps1 script I can start it the program with the following command successfully:
& "c:\Program Files\Java\jdk1.6.0_20\jre\bin\java" -server -Xloggc:.\engine.gc.log -Xmx2048m -Xms2048m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:SurvivorRatio=8 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:MaxTenuringThreshold=8 -XX:CMSInitiatingOccupancyFraction=60 -XX:+PrintGCTimeStamps -XX:MaxPermSize=128m -XX:PermSize=128m -DinstName=TESTING -DprocType=ENGINE -classpath ".\configuration;dist\lib\Dacar-Engine.jar;dist\lib\Dacar-Common.jar;dist\lib\Dacar-Collector.jar;dist\lib\standalone-Dacar.jar;dist\lib\DACAR-CRG.jar;;jars\activation.jar;jars\commons-beanutils-1.6.jar;jars\commons-codec-1.3.jar;jars\commons-collections-3.2.jar;jars\commons-configuration-1.4.jar;jars\commons-dbcp-1.4.jar;jars\commons-digester-1.6.jar;jars\commons-discovery-0.4.jar;jars\commons-id.jar;jars\commons-lang-2.2.jar;jars\commons-logging-1.0.3.jar;jars\commons-pool-1.5.4.jar;jars\concurrent.jar;jars\graphics.jar;jars\ha-javamail-1.0-beta-1.jar;jars\hsqldb.jar;jars\ibatis-core-3.0.jar;jars\jcommon-1.0.6.jar;jars\jconn3.jar;jars\jdom.jar;jars\jetty-6.1.15.jar;jars\jetty-util-6.1.15.jar;jars\jfreechart-1.0.3.jar;jars\jgroups-all.jar;jars\jmxri.jar;jars\jta.jar;jars\junit.jar;jars\log4j-1.2.9.jar;jars\mailapi.jar;jars\postgresql-8.0.309.jdbc2ee.jar;jars\postgresql-8.4-701.jdbc3.jar;jars\quartz-1.6.0.jar;jars\servlet-api-2.5-20081211.jar;jars\smtp.jar;jars\svnant.jar;jars\svnClientAdapter.jar;jars\svnjavahl.jar;jars\truezip-6.jar;jars\uic-optional.jar;jars\uic.jar" com.sungard.sims.dacar.standalone.Dacar
But that is not really an option, as That is just invoking the thing in a hard coded fashion.
One thing to note about PowerShell variable expansion is that if it's anything more than a simple $VARIABLE expression you typically need to escape it using curly braces or a sub-expression.
So this line:
$JAVA_EXE="$ENV:JDK15\jre\bin\java"
Could be represented as either:
$JAVA_EXE="${ENV:JDK15}\jre\bin\java"
or...
$JAVA_EXE="$($ENV:JDK15)\jre\bin\java"
EDIT: Apparently PowerShell does
correctly evaluate all 3 examples. I
seem to recall the first syntax not
working but perhaps that was in
PowerShell 1.0 or a CTP...
Another useful tip that I often suggest people do when working with external .exe commands is to map it to an alias using the Set-Alias command. This way it makes working with the command a lot more natural as you don't have to use the &"string" syntax.
Set-Alias java "$($ENV:JDK15)\jre\bin\java.exe"
java blah1 blah2 etc

Categories