Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
waynesmith
Participant

How to reset JVM options in SAP Mobile Platform 2.3

Purpose

How to revert back to the original JVM option settings in SAP Mobile Platform.

Description:

From time to time administrators of SAP Mobile Platform may need to
add additional Java Virtual Machine (JVM) flags. The JVM flags are case sensitive
and can vary in different
JVM versions. If we add the value and it is incorrect or is
not supported the JVM will not be able to start and there will be specific errors in
the server log related to the JVM.
“There are many root causes for being unable to
create the JVM such as bad JVM flags, typographical errors, or leading spaces.

.
We will walk through several steps to recover the SMP server and adjust the JVM flags.   

Required Software

  • 1.    SMP 2.3 or higher.
  • 2.    Read write access.
  • 3.    Standard text editor.

Assumption:

You have a working SAP Mobile Platform and access to the supAdmin account.
And you are testing in development or in a QA environment. It is not recommended
to perform these steps in a production environment unless you are working directly
with SAP product support or sustaining engineering.


Problem:

You see from the SAP web site that there are several configuration options for the JVM
to help with garbage collection and memory usage.

For example.

-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode-XX:+CMSClassUnloadingEnabled

An admin will log into the SAP Control Center Configuration, go to the General tab option, and
then select performance and Java Virtual Machine.

                        
Figure 1

In the User options you paste in the new flags:

-XX:+UseConcMarkSweepGC-XX:+CMSIncrementalMode -XX:+CMSClassUnloadingEnabled

You then click ok and save.  Then restart the SAP Mobile Server.

After restarting the SAP Mobile Server you attempt to log in.

At this point you get an error message and fail to login.  You check to see if the Mobile server
is running and go look at the service and see that the Mobile server stopped.

You then check the SAP Mobile server log. The error “unable to start
Java Virtual Machine or unrecognized JVM configuration flag.” is in the log.

This error indicates the JVM flags are not correct for some reason.

At this point the SAP Mobile Server is down and will not stay up and running until
reverting back to the original JVM settings.

Solution:

The following steps are needed to revert the User options field back to the original setting.

Step One: You will need to edit the sup.properties file in.

C:\SAP\MobilePlatform\Servers\UnwiredServer\Repository\Instance\com\sybase\sup\server\SUPServer

Go to the line DJC_JVM and remove the three JVM flags:

DJC_JVM_USEROPTIONS=-XtraceFile\=./../../UnwiredServer/logs/sapjvmtrc.out -XtraceFileCount\=3
-XX\:MaxPermSize\=512M -XX\:-DumpGCStatisticForLongGCs-XX\:HeapDumpPath\=./../../UnwiredServer/logs
-XX\:+HeapDumpOnOutOfMemoryError -XX\:-EnableDebuggingOnDemand -XX\:-TraceClassUnloading
-XX\:+UseConcMarkSweepGC -XX\:+CMSIncrementalMode–XX\:+CMSClassUnloadingEnable

After removing the flag options your DJC_JVM_USEROPTIONS property should look like this:

DJC_JVM_USEROPTIONS=-XtraceFile\=./../../UnwiredServer/logs/sapjvmtrc.out -XtraceFileCount\=3
-XX\:MaxPermSize\=512M -XX\:-DumpGCStatisticForLongGCs
-XX\:HeapDumpPath\=./../../UnwiredServer/logs -XX\:+HeapDumpOnOutOfMemoryError
-XX\:-EnableDebuggingOnDemand -XX\:-TraceClassUnloading

Save your sup.propertiesfile and exit and close your editor.

Step Two: You will need to edit the mlsrv.ext.ini file


Go to C:\SAP\MobilePlatform\Servers\UnwiredServer\bin directory

Edit mlsrv.ext.ini and search for or go to the line XtraceFile.  This is the starting point:

\sapjco\v3\64bit" -Xverify:none  -Xms512M -Xmx2048M -XtraceFile=./../../UnwiredServer/logs/
sapjvmtrc.out -XtraceFileCount=3 -XX:MaxPermSize=512M
-XX:-DumpGCStatisticForLongGCs -XX:HeapDumpPath=./../../UnwiredServer/logs
-XX:+HeapDumpOnOutOfMemoryError-XX:-EnableDebuggingOnDemand -XX:-TraceClassUnloading
-XX\:+UseConcMarkSweepGC-XX\:+CMSIncrementalMode –XX\:+CMSClassUnloadingEnable

Remove the three JVM flags:
-XX\:+UseConcMarkSweepGC-XX\:+CMSIncrementalMode –XX\:+CMSClassUnloadingEnable

Your line now should look like this.

\sapjco\v3\64bit" -Xverify:none  -Xms512M -Xmx2048M -XtraceFile=./../../UnwiredServer/logs/sapjvmtrc.out
-XtraceFileCount=3 -XX:MaxPermSize=512M
-XX:-DumpGCStatisticForLongGCs -XX:HeapDumpPath=./../../UnwiredServer/logs
-XX:+HeapDumpOnOutOfMemoryError-XX:-EnableDebuggingOnDemand -XX:-TraceClassUnloading

Step Three: You need to delete the mlsrv.ini.

Go to C:\SAP\MobilePlatform\Servers\UnwiredServer\bin directory and delete the mlsrv.ini file.
This will be recreated in Step Four.

Step Four: Recreating the mlsrv.ini file

Create an empty file named sup.cff in the directory:C:\SAP\MobilePlatform\Servers\UnwiredServer\bin\private
With the file sup.cff in place SMP will create the mlsrv.ini fileduring the next boot process.

Step Five: Reverting the CLUSTER_PROP table to the default configuration.

Go to C:\SAP\MobilePlatform\Servers\SQLAnywhere16\BIN32

Start the scjview.exe

Figure 2.

Click open a connection to the Clusterdb_32bit.

Figure 3   

Once you are connected double click on Tables.

Figure 4 

Go to the CLUSTER_PROP table.

Figure 5 


Right click and select View Data in Interactive SQL
.

Figure 6   

You will have a screen that list all the columns in the database.

Scroll down to the line DJC_JVM_USEROPTIONS.

Figure 7 

Right click on the line and select and select Generate UPDATE statement.

Figure 8 

You will get a popup message Click OK.

Figure 9 

Go to the SQL Statement panel in Interactive SQL and clear anything that may
already be there. Then right click and paste in the update statement shown below.

Figure 10  

UPDATE "DBA"."CLUSTER_PROP" SET "NAME"='DJC_JVM_USEROPTIONS',"VALUE"='
-XtraceFile=./../../UnwiredServer/logs/sapjvmtrc.out-XtraceFileCount=3 -XX:MaxPermSize=512M
-XX:-DumpGCStatisticForLongGCs -XX:HeapDumpPath=./../../UnwiredServer/logs
-XX:+HeapDumpOnOutOfMemoryError-XX:-EnableDebuggingOnDemand -XX:-TraceClassUnloading
-XX\:+UseConcMarkSweepGC -XX\:+CMSIncrementalMode –XX\:+CMSClassUnloadingEnable
-Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080',"CLUSTERID"=1,"TYPE"='CLUSTER' WHERE "NAME"='
DJC_JVM_USEROPTIONS' AND "CLUSTERID"=1

Edit the update statement and only remove the -XX\:+UseConcMarkSweepGC
-XX\:+CMSIncrementalMode –XX\:+CMSClassUnloadingEnable

Be careful when editing that you take out the dashes that only belong to the flags
that we added. 

Once you have completed the editing and everything looks good execute
the update to the table.

If the execution is successful exit out of Interactive SQL and scjview.

Then go to your desktop and right click on the Start SMP server icon and Run as Administrator.

The SMP server will start up and be back on line. If it does not start correctly then review the steps and
double check the JVM flags to make sure they are correct.

A good recommendation is to use the default values as they are known to be correct.

Summary

If you add an entry to the JVM user options and the server won’t stay up and running then the steps
outlined in this document will help you recover without uninstalling and reinstall the SAP Mobile Platform.

There are different causes for the JVM to not start properly.  For example, typos, additional line spaces, or the
flags are not supported. It is always advised to test the JVM user options in a test environment first,
then move to production. For example, the JVM user flag
–XX\:+CMSClassUnloadingEnable
is deprecated and no
longer supported in JVM version 7 where it is supported in JVM 6.x. This document will at least help in recovering
from using a bad JVM flag.