I upgraded Java and now Tomcat service won't start [duplicate] - java

This question already has answers here:
Unrecognized VM option 'UseParNewGC' , Error: Could not create the Java Virtual Machine
(5 answers)
Closed 14 days ago.
I recently upgraded Java and now Tomcat service won't start. This is on an Ubuntu 16.04 LTS server. Tomcat is version 8.5. I upgraded from Java 7 to Java 11, Azul Zulu 7 to Azul Zulu 11. When running systemctl status tomcat85 I see the following not particularly helpful output:
Although the service won't seem to work, I can start Tomcat manually with the following command:
/opt/tomcat85/bin/startup.sh
These are the contents of the service file:
[Unit]
Description=Apache Tomcat 8.5 Servlet Container
After=syslog.target network.target
[Service]
User=tomcat85
Group=tomcat85
Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/zulu-11-amd64
Environment=CATALINA_PID=/opt/tomcat85/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat85
Environment=CATALINA_BASE=/opt/tomcat85
EnvironmentFile=/etc/default/tomcat85
WorkingDirectory=/opt/tomcat85
ExecStart=/opt/tomcat85/bin/startup.sh
ExecStop=/opt/tomcat85/bin/shutdown.sh
#Restart=on-failure
StandardOutput=syslog
StandardError=syslog
LimitNOFILE=65536
SyslogIdentifier=tomcat85
[Install]
WantedBy=multi-user.target
Running journalctl -xe provides no meritorious information.
catalina.out reveals the following error:
I'm not sure where to go next with troubleshooting this issue. There are several seemingly related discussions on Stack but none have provided a solution as of yet. Any help is appreciated and I'm happy to add more information as requested.

I have found the answer thanks to some good feedback here in this post. The problem was several deprecated entries in the EnvironmentFile:
/etc/default/tomcat85
JAVA_OPTS="-server -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseTLAB -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:PermSize=1024M -XX:MaxPermSize=1024m -Xms16384m -Xmx20480m"
One of the errant entries was:
-XX:+UseParNewGC
The updated entry is:
-XX:+UseG1GC
Additionally the following entries needed to be removed:
UseConcMarkSweepGC
PermSize
MaxPermSize

Related

How to fix "Unrecognized VM option 'UseConcMarkSweepGC'" error?

I have followed the instructions for getting started with codenameone in IntelliJ, yet when I set up my first project, based on the sample app I get this error:
"C:\Program Files\Java\jdk-15.0.1\bin\java.exe" -Xms128m -Xmx1014m -XX:ReservedCodeCacheSize=512m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -XX:CICompilerCount=2 -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -ea -Dsun.io.useCanonCaches=false -Djdk.http.auth.tunneling.disabledSchemes=\"\" -Djdk.attach.allowAttachSelf=true -Djdk.module.illegalAccess.silent=true -Dkotlinx.coroutines.debug=off "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.3.1\lib\idea_rt.jar=61544:C:\Program Files\JetBrains\IntelliJ IDEA 2020.3.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\reinp\OneDrive - beuthhs\beuth\Patterns und Frameworks\justtrivia\out\production\justtrivia;C:\Users\reinp\OneDrive - beuthhs\beuth\Patterns und Frameworks\justtrivia\src;C:\Users\reinp\OneDrive - beuthhs\beuth\Patterns und Frameworks\justtrivia\lib\CodenameOne.jar;C:\Users\reinp\OneDrive - beuthhs\beuth\Patterns und Frameworks\justtrivia\JavaSE.jar;native\internal_tmp;lib\impl\cls" com.codename1.impl.javase.Simulator com.patrickreinbold.justtrivia.JustTrivia
Unrecognized VM option 'UseConcMarkSweepGC'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Process finished with exit code 1
I saw that this has to do with Java 8 but in the IntelliJ instructions it says nothing about using Java 8. Is Java 8 always necessary or can codenameone run with Java 15, too?
EDIT:
I have now got it to open by simply copying the first line with the java command and removing the UseConcMarkSweepGC flag, then running it in terminal. But I am still not sure if that is "the correct way" to do it or if something could break along the way now.
Ignore unsupported VM options with another option:
-XX:+IgnoreUnrecognizedVMOptions
This is a problem with the netbeans build script but this isn't really relevant as Codename One only supports Java 8 and Java 11 (at this time) so you should use one of those versions at the moment.
run export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Homebrew users:
Comment out these lines
# /usr/local/etc/elasticsearch/jvm.options
## GC configuration
#-XX:+UseConcMarkSweepGC
#-XX:CMSInitiatingOccupancyFraction=75
#-XX:+UseCMSInitiatingOccupancyOnly
Then if you get
Invalid -Xlog option '-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m'
Update the logging file path
# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m
to
# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=/usr/local/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m
Sources
Brew installed Elasticsearch 7.9.2 failing on macOS
https://stackoverflow.com/a/57993824/2237510

Could not reserve enough space for object heap - Intellji 2018.1 with wildfly 9.0.2 - trying run web application

I am trying to run a web application project, but there is an error when executing
Error occurred during initialization of VM
Could not reserve enough space for object heap
I attached an image for more detail
Error details - intellji
I have been looking for the solution in different forums
the majority indicates
"Run the JVM with -XX: MaxHeapSize = 512m (or any big number) (or -Xmx512m for short)"
I have configured this in intellij, but the error persists
-Xms128m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m
AND
-Xms128m -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m
Config Xmx512m
I am temporarily solving this problem by uninstalling wildfly (clean folder wildfly_902), reconfiguring jboss in Intellij and finally restarting the OS. But this I have to do every 4 hours
Feature:
IntelliJ IDEA 2018.1 (Ultimate Edition)
Build #IU-181.4203.550, built on March 26, 2018
wildfly 9.0.2
OS: Windows 10 Enterprise 2016 LTSB
jdk 7
thx

JBoss 7 with JAVA 8 [duplicate]

I am trying to run JBoss from the command prompt with the standalone.bat file. It starts the startup process but then just sits there. I couldn't really find any answers with Goolgle or on here.
Here is the output from my command line:
C:\jboss-as-7.1.1.Final\jboss-as-7.1.1.Final\bin>standalone
Calling "C:\jboss-as-7.1.1.Final\jboss-as-7.1.1.Final\bin\standalone.conf.bat"
===============================================================================
JBoss Bootstrap Environment
JBOSS_HOME: C:\jboss-as-7.1.1.Final\jboss-as-7.1.1.Final
JAVA: C:\Program Files\Java\jre8\bin\java
JAVA_OPTS: -XX:+TieredCompilation -Dprogram.name=standalone.bat -Xms64M -Xmx51
2M -XX:MaxPermSize=256M -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.se
rver.gcInterval=3600000 -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.war
ning=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djboss.server.default.c
onfig=standalone.xml
===============================================================================
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; sup
port was removed in 8.0
16:06:41,708 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA
16:06:42,009 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
16:06:42,075 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" sta
rting
And it just sits right here. Any ideas of why it doesn't finish starting up?
This is added info...
I took Omoro's suggestion and went back to Java 7. That got JBoss to not "hang" anymore at the command line. Now when I run standalone.bat it says
Calling "C:\jboss-as-7.1.1.Final\jboss-as-7.1.1.Final\bin\standalone.conf.bat"
and then just goes back to the command prompt without starting JBoss. I will open a new thread since the old problem has been cured and now a new problem has arisen.
Thanks for everyone's help especially Omoro.
This is a known issue. See more discussion at:
https://community.jboss.org/message/808212
Quoting from the thread:
Yes it is normal.
There have been some changes in JDK8 that prevent
AS7 and current version of EAP6 to start under JDK8. We have many
JDK8 related fixes in WildFly so I would recommend you to use that.
As for EAP goes, the start up on JDK8 is fixed in upcoming 6.2 release.
Use WildFly 10, works like a charm even with Java 8.
Remember JBossAS changed name to WildFly.
I faced the same issue when starting JBoss 7 with Java version 8. All you need to do is change to Java version 7 or 6 and then try to start JBoss again.
For ubuntu user use following command to change default Java JDK version:
sudo update-alternatives --config java
This will give you a list output similar to this:
There are 2 choices for the alternative java (providing
/usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-6-oracle/jre/bin/java 1070 auto mode
1 /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java 1051 manual mode
* 2 /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java 1069 manual mode
Press enter to keep the current choice[*], or type selection number:
Select proper option and this will change default Java JDK version.
To verify type:
$java -version
Solution : This Issue comes when Java jdk1.8.0_40 is installed in your system and the same is mapped in JAVA_HOME system variable . This issue can be sorted out by installing Java 7 with its jdk jdk1.7.0_79 and mapping the same in JAVA_HOME as C:\Progra~1\Java\jdk1.7.0_79 . The JBOSS server will start successfully .
I too came across this issue. Firstly I downgraded to JDK 1.7 and it happened to work smoothly but as I wanted to work on JDK 1.8, I downloaded WildFly 10 former JBossAS.
It works smoothly without any compatibility issues.
If you really need to work with JBoss7.1, downgrade your java version from 1.8 to 1.7 or 1.6. (To check your current java version type java -version in command line). Otherwise, you can change your application server to Wildfly as stated in previous answers.
For those who're facing this issue while starting JBoss 7.1 in Eclipse:
Navigate to Window --> Preferences --> Java --> Installed JREs
Add/Select JDK/JRE 1.6/1.7
Navigate to Window --> Preferences --> Server --> Runtime Environments
Select JBoss 7.1 Runtime Environment and click 'Edit'
Select JRE 1.6/1.7 as Runtime JRE
Instead of jdk 8 (it has old compatibility problem with jboss), use only version which your project required.

Jetty 8 cannot launch java web-app on AWS EC2 server

I am trying to launch a war (dss-server.war) file using Jetty on Ubuntu 13.10 Server using the Amazon EC2 service. The project in question uses maven, java, apache-camel, spring and SIGAR. However the process is killed for no apparent reason at all:
Please use CMSClassUnloadingEnabled in place of CMSPermGenSweepingEnabled in the future
2014-02-26 22:40:48.737:INFO:oejs.Server:jetty-8.1.14.v20131031
2014-02-26 22:40:48.798:INFO:oejdp.ScanningAppProvider:Deployment monitor /home/ubuntu/jetty-distribution-8.1.14.v20131031/webapps at interval 1
2014-02-26 22:40:48.814:INFO:oejd.DeploymentManager:Deployable added: /home/ubuntu/jetty-distribution-8.1.14.v20131031/webapps/dss-server.war
2014-02-26 22:40:49.096:INFO:oejw.WebInfConfiguration:Extract jar:file:/home/ubuntu/jetty-distribution-8.1.14.v20131031/webapps/dss-server.war!/ to /tmp/jetty-0.0.0.0-8080-dss-server.war-_dss-server-any-/webapp
2014-02-26 22:41:17.170:INFO:dss-server:No Spring WebApplicationInitializer types detected on classpath
2014-02-26 22:41:19.193:INFO:dss-server:Initializing Spring root WebApplicationContext
2014-02-26 22:41:32.409:INFO:dss-server:Initializing Spring FrameworkServlet 'dss'
Killed
I am launching the project using the following command line:
java -jar -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:PermSize=128M -XX:MaxPermSize=256M start.jar > output.txt
And the output file does not show anything incriminatory as well.
What am I missing?
Finally got it. The problem lies with OpenJDK. The previous configuration that I have mention will NOT work with openJDK (probably because Jetty does not like it). It has to be Java from oracle. I fixed the problem by installing Oracle's Java by following this article:
http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

Increase Windows installer-based Tomcat PermGen Space

I'm having some problems with Tomcat. I'm deploying a Grails application and as I were adding new features I got this (sadly well known) error in the stacktrace file:
Caused by: java.lang.OutOfMemoryError: PermGen space
2014-01-13 19:28:35,753 [http-bio-8080-exec-26] ERROR StackTrace - Full Stack Trace:
org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.OutOfMemoryError: PermGen space
at gsp_liquidaciones_liquidacionDeComplejolist_gsp$_run_closure2.doCall(gsp_liquidaciones_liquidacionDeComplejolist_gsp.groovy:84)
at gsp_liquidaciones_liquidacionDeComplejolist_gsp.run(gsp_liquidaciones_liquidacionDeComplejolist_gsp.groovy:105)
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:195)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
...
I have an Windows installer-based tomcat installation and I don't have an catalina.bat file also. Googling many pages suggest to modify this file (catalina.bat) or register JAVA_OPTS variable, but nothing works. So, where do I have to specify this parameters?:
SET JAVA_OPTS="-Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC”
I have tried to modify the Java Options through Apache Tomcat 7 Properties window but after the modifications the server can't start.
My computer has 4Gb RAM installed.
Thanks in advance.
For the following system specifications:
Windows 7 64-bit
4 GB installed RAM
Intel Core i7 processor
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
The Tomcat 7 Java properties for an acceptable behavior MIGHT be:
You should have a small windows application 'tomcat6w.exe' or 'tomcat7w.exe' when tomcat was installed as a windows service. When you start this application it has a tab 'Java' where you can set the JVM parameters. For more details see more memory to Tomcat service.
You need to enter only the parameters which start with -X.
This work for me in apache-tomcat-8.0.15, but i think it would be the same for all to tomcat's version.
I had executed regedit and found this path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tomcat8
And change ImagePath key to:
C:\apache-tomcat-8.0.15\bin\tomcat8.exe //RS//Tomcat8 ++JvmOptions -XX:PermSize=128m -XX:MaxPermSize=512m

Categories

Resources