1. Home
  2. WordPress
  3. Unrecognized VM option MaxMetaspaceSize=256m – oxd-server failed to start [Solution]
  1. Home
  2. Linux
  3. Unrecognized VM option MaxMetaspaceSize=256m – oxd-server failed to start [Solution]

Unrecognized VM option MaxMetaspaceSize=256m – oxd-server failed to start [Solution]

Recently I have been trying my hands with SSO using OpenID connect single sign-on plugin by Gluu. One of the prerequisite for the plugin is to install Oxd server and run it on port 8099. Well, the Oxd server installation went on smooth, but the daemon failed to start. This tutorial explains how to fix ‘Unrecognized VM option MaxMetaspaceSize‘ error that prevented oxd server from starting.

root@opidclient:~# /etc/init.d/oxd-server start
 oxd-server is already running ...
 PID: [1370]

Though the above snapshot says oxd-server has been started, but it didn’t. Also, there were no error message or so in the standard output and as well as in the oxd server log files. However, I could find some information about the oxd-server configuration via '/etc/init.d/oxd-server status' command.

root@opidclient:~# /etc/init.d/oxd-server status
oxd server NOT running
OXD_HOME = /opt/oxd-server
OXD_BASE = /opt/oxd-server
OXD_PID_FILE = /var/run/oxd-server.pid
OXD_START = org.xdi.oxd.server.ServerLauncher
OXD_LOGS = /var/log/oxd-server
OXD_STATE = /opt/oxd-server/oxd-server.state
JAVA = /usr/bin/java
JAVA_OPTIONS = -server -Xms256m -Xmx512m -XX:MaxMetaspaceSize=256m -XX:+Disab leExplicitGC -Doxd.server.config=/etc/oxd/oxd-server/oxd-conf.json -Dlog4j.confi guration=/etc/oxd/oxd-server/log4j.xml -cp /opt/oxd-server/lib/bcprov-jdk15on-1. 54.jar:/opt/oxd-server/lib/oxd-server-jar-with-dependencies.jar -Doxd.logging.di r=/var/log/oxd-server -Doxd.home=/opt/oxd-server -Doxd.base=/opt/oxd-server -Dja va.io.tmpdir=/tmp
OXD_ARGS = oxd-server.state=/opt/oxd-server/oxd-server.state
RUN_CMD = /usr/bin/java -server -Xms256m -Xmx512m -XX:MaxMetaspaceSize=256m -XX:+DisableExplicitGC -Doxd.server.config=/etc/oxd/oxd-server/oxd-conf.json -Dlog4j.configuration=/etc/oxd/oxd-server/log4j.xml -cp /opt/oxd-server/lib/bcp rov-jdk15on-1.54.jar:/opt/oxd-server/lib/oxd-server-jar-with-dependencies.jar -D oxd.logging.dir=/var/log/oxd-server -Doxd.home=/opt/oxd-server -Doxd.base=/opt/o xd-server -Djava.io.tmpdir=/tmp org.xdi.oxd.server.ServerLauncher oxd-server.state=/opt/oxd-server/oxd-server.state

From the above output, I got to know the command (RUN_CMD) that actually starts oxd-server daemon.

I just executed the command and found the issue that prevented oxd-server from starting. Here’s the snapshot of it.

root@opidclient:~# /usr/bin/java -server -Xms256m -Xmx512m -XX:MaxMetaspaceSize=256m -XX:+DisableExplicitGC -Doxd.server.config=/etc/oxd/oxd-server/oxd-conf.json -Dlog4j.configuration=/etc/oxd/oxd-server/log4j.xml -cp /opt/oxd-server/lib/bcp rov-jdk15on-1.54.jar:/opt/oxd-server/lib/oxd-server-jar-with-dependencies.jar -D oxd.logging.dir=/var/log/oxd-server -Doxd.home=/opt/oxd-server -Doxd.base=/opt/o xd-server -Djava.io.tmpdir=/tmp org.xdi.oxd.server.ServerLauncher oxd-server.sta te=/opt/oxd-server/oxd-server.state
 Unrecognized VM option MaxMetaspaceSize=256m
 Error: Could not create the Java Virtual Machine.
 Error: A fatal exception has occurred. Program will exit.

The error “Unrecognized VM option MaxMetaspaceSize=256m” prevented the creation of Java Virtual Machine.

How to fix Unrecognized VM option MaxMetaspaceSize=256m

Oxd-server daemon is dependent on Java. Lets check the version of Java using the below command.

root@opidclient:~# java -version
 java version "1.7.0_181"
 OpenJDK Runtime Environment (IcedTea 2.6.14) (7u181-2.6.14-0ubuntu0.1)
 OpenJDK 64-Bit Server VM (build 24.181-b01, mixed mode)

The Java version 1.7.0 does not recognize VM option MaxMetaspaceSize, instead MaxPermSize should be used. However MaxMetaspaceSize is supported in Java Version 8 (i.e., java 1.8). So let’s install Oracle Java version 8 as shown below:

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update 
$ sudo apt-get install oracle-java8-installer
$ sudo apt-get install oracle-java8-set-default

Let’s check the version of Java:

root@opidclient:~# java -version
 java version "1.8.0_171"
 Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
 Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

Now, I tried starting oxd-server and it worked.

root@opidclient:~# /etc/init.d/oxd-server start
 Starting oxd-server:
 Checking logs for possible errors:
 PID: [3797]
 OK Thu Jun 28 07:27:22 UTC 2018
 root@opidclient:~# ps -aef|grep oxd
 jetty 3797 1 51 07:27 ? 00:00:04 /usr/bin/java -server -Xms256m -Xmx512m -XX:MaxMetaspaceSize=256m -XX:+DisableExplicitGC -Doxd.server.config=/etc/oxd/oxd-server/oxd-conf.json -Dlog4j.configuration=/etc/oxd/oxd-server/log4j.xml -cp /opt/oxd-server/lib/bcprov-jdk15on-1.54.jar:/opt/oxd-server/lib/oxd-server-jar-with-dependencies.jar -Doxd.logging.dir=/var/log/oxd-server -Doxd.home=/opt/oxd-server -Doxd.base=/opt/oxd-server -Djava.io.tmpdir=/tmp org.xdi.oxd.server.ServerLauncher oxd-server.state=/opt/oxd-server/oxd-server.state start-log-file=/var/log/oxd-server/start.log
 root 3827 1581 0 07:27 pts/0 00:00:00 grep --color=auto oxd
root@opidclient:~# telnet 0 8099
 Connected to 0.
 Escape character is '^]'.

That’s it!. Hope it helps someone in need.

Updated on June 29, 2018

Was this article helpful?

Related Articles

Add A Comment