Invalid initial heap size Exception when building new Container

Gunnar G H Finkeldeh, geändert vor 3 Jahren.

Invalid initial heap size Exception when building new Container

Youngling Beiträge: 6 Beitrittsdatum: 18.06.21 Neueste Beiträge
Hi,

I am desparately looking for help to resolve an issue when building a new container. This affects every one of the different builds, i.e. MySQL, MariaDB, etc. I have had a look in the documentation and also in the docker-compose and the Dockerfile there is mention of using JAVA_OPTS for additional settings, but in each case the documentation is very thin and also changes between windows/linux solution making it very difficult to find a solution.
Exception on start up:
creating /data/mysql-data
creating /data/klaros-home
creating /data/catalina-base
creating /data/catalina-base/temp
creating /data/catalina-base/logs
creating link /data/catalina-base/conf
creating link /data/catalina-base/webapps
creating link /data/mysql-data/error.log
ln: failed to create symbolic link '/var/log/mysql/error.log': No such file or directory
NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Invalid initial heap size: -Xmsm
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I see that we are specifying, however I am not sure if this relates directly to the heap size when starting up the Tomcat Server
# Minimum available RAM in MB
MEMORY_MIN=256
# Maximum available RAM in MB
MEMORY_MAX=1024
I definitely know the issue is around not specifying/or having incorrect ENV settings. How do I resolve this or is this a global fix that needs to be pushed to GIT?

Your help is much appreciated, thanks
Gunnar G H Finkeldeh, geändert vor 3 Jahren.

RE: Invalid initial heap size Exception when building new Container

Youngling Beiträge: 6 Beitrittsdatum: 18.06.21 Neueste Beiträge
Ok i seem to have fixed the heap size issue. the below was missing in the Dockerfile
# Minimum available RAM in MB
ENV TOMCAT_MEMORY_MIN 256
# Maximum available RAM in MBENV TOMCAT_MEMORY_MAX 1024

however once started up i now have a DB connection issue. See attached log file
thumbnail
Torsten Stolpmann, geändert vor 3 Jahren.

RE: Invalid initial heap size Exception when building new Container

Jedi Council Member Beiträge: 759 Beitrittsdatum: 12.02.09 Neueste Beiträge
Hello Gunnar,

from what I gather from your post, you are missing the .env file where these variables are defined.

Can you please check this?

If you find any missing or wrong information in the documentation, please don't hesitate to open an issue on GitHub.

Kind regards,

Torsten
Gunnar G H Finkeldeh, geändert vor 3 Jahren.

RE: Invalid initial heap size Exception when building new Container

Youngling Beiträge: 6 Beitrittsdatum: 18.06.21 Neueste Beiträge
Hi Torsten,

Thank you for getting back to me.

I do have the .env file present and it does have the heap size variables in there, but when building the containers it appears as if it's parsing those from the Dockerfile and not the .env file. This is fine once you have added the MIN MAX heap size in the Dockerfile, but the new issue is that I can't seem to connect to the DB once it started up, hence I posted the log file for that.
Gunnar G H Finkeldeh, geändert vor 3 Jahren.

RE: Invalid initial heap size Exception when building new Container

Youngling Beiträge: 6 Beitrittsdatum: 18.06.21 Neueste Beiträge
Quick Update:

I copied all the database ENV varaibles from the .env file and moved them to the Dockerfile. When doing this the DB variables are passed on to the hibernate.properties file as expected, but I believe the ENV variables are incorrect and therefore the DB connection fails.

Using the DB hibernate.properties from the User manual doesn't work either, so even though I now kinda know what the issue is, I am still stuck. I believe the documentation refers to the windows hibernate.properties and not the container specific ones.

Any further help in troubleshooting this would be greatly appreciated.
thumbnail
Torsten Stolpmann, geändert vor 3 Jahren.

RE: Invalid initial heap size Exception when building new Container

Jedi Council Member Beiträge: 759 Beitrittsdatum: 12.02.09 Neueste Beiträge
Hi Gunnar,

I think you are applying the wrong instructions here.

https://github.com/klaros-testmanagement/klaros-docker/blob/master/Readme.adoc just describes the quick startup for a plain docker image using the embedded Derby database.

If you like to use another database like MySQL please follow https://github.com/klaros-testmanagement/klaros-docker/blob/master/Documentation.adoc.

https://github.com/klaros-testmanagement/klaros-docker/blob/master/Documentation.adoc#configuring-docker-environment-variables shows what do for configuration.

Basically you should  just go the directory of choice, edit the .env file and use docker-compose build to build your image.

Hope this helps. Please let me know if that works for you.

Regards,

Torsten
Gunnar G H Finkeldeh, geändert vor 3 Jahren.

RE: Invalid initial heap size Exception when building new Container

Youngling Beiträge: 6 Beitrittsdatum: 18.06.21 Neueste Beiträge
Thank you soo sooo much Torsten for you much appreciated help

I followed the incorrect build instructions, hence all the issues.

Following this documentation: https://github.com/klaros-testmanagement/klaros-docker/blob/master/Documentation.adoc worked beautifully!

Thank you again
Gunnar