Setting JVM options on Beanstalk Tomcat

0

Trying to set options as follows:

-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=5004,suspend=n

Using both "Container Options > JVM options" and as a Environment Property as follows: Name: _JAVA_OPTIONS Value: -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=5004,suspend=n

Neither approach seemed to work. Tomcat starts as follows:

12-Apr-2022 02:24:46.838 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/8.5.75 12-Apr-2022 02:24:46.844 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Feb 28 2022 18:26:53 UTC 12-Apr-2022 02:24:46.848 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 8.5.75.0 12-Apr-2022 02:24:46.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux 12-Apr-2022 02:24:46.851 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.14.268-205.500.amzn2.x86_64 12-Apr-2022 02:24:46.851 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64 12-Apr-2022 02:24:46.852 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64/jre 12-Apr-2022 02:24:46.853 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_322-b06 12-Apr-2022 02:24:46.854 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Amazon.com Inc. 12-Apr-2022 02:24:46.854 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/share/tomcat 12-Apr-2022 02:24:46.855 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/share/tomcat 12-Apr-2022 02:24:46.858 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib] 12-Apr-2022 02:24:47.016 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"] 12-Apr-2022 02:24:47.045 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 12-Apr-2022 02:24:47.074 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1048 ms 12-Apr-2022 02:24:47.165 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina] 12-Apr-2022 02:24:47.173 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/8.5.75] 12-Apr-2022 02:24:47.242 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/var/lib/tomcat/webapps/jcs.war] 12-Apr-2022 02:24:56.187 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/var/lib/tomcat/webapps/jcs.war] has finished in [8,943] ms 12-Apr-2022 02:24:56.192 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/var/lib/tomcat/webapps/work.war] 12-Apr-2022 02:25:35.849 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/var/lib/tomcat/webapps/work.war] has finished in [39,657] ms 12-Apr-2022 02:25:35.863 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 12-Apr-2022 02:25:35.875 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 48794 ms

How are JVM options supposed to be set in this environment?

Thanks much.

jack
asked 2 years ago1311 views
3 Answers
0

According to the docs the namespace aws:elasticbeanstalk:container:tomcat:jvmoptions should be used to set JVM Options.

AWS
EXPERT
Peter_G
answered 2 years ago
0

I was able to set the following in Configuration > Software > Container Options > JVM Options which opened up the port:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5004

However I tried to set the same option in .ebextensions/tomcat-settings.config file to no affect. Not even sure if bundle deploy is handling this file at all. It is not copied to /etc/tomcat/conf.d. If I manually copy it to /etc/tomcat/conf.d it apparently is not used to configure Tomcat. Is there a known issue with this approach?

.ebextensions/tomcat-settings.config content:

option_settings: aws:elasticbeanstalk:container:tomcat:jvmoptions: Xms: 1024m Xmx: 2048m JVM Options: '-agentlib: jdwp=transport=dt_socket,server=y,suspend=n,address=5004'

aws:elasticbeanstalk:environment:proxy: ProxyServer: apache

jack
answered 2 years ago
0

I had problems with this configuration as well. My mistake was that I wasn't enclosing the values in single quotes. The parameter value should be in single quotes: '-Duser.language=pt -Duser.region=BR'. My tomcat-setting.config ended up like this:

{ "option_settings": [ {
"namespace": "aws:elasticbeanstalk:container:tomcat:jvmoptions", "option_name": "JVM Options", "value": "'-Duser.language=pt -Duser.region=BR'" } ] }

answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions