We'll see how to install and activate JRebel on GlassFish standalone server.
The following are the steps that describe how to activate JRebel on GlassFish server:
Download and GlassFish server from https://glassfish.java.net/download.html and unzip it.
Launch GlassFish with the startup script located in its
bin
folder (bin\asadmin.bat
on MS Windows). To start the default domain, run this command:asadmin start-domain domain1
.Enable the JRebel Java Agent for the GlassFish server. To proceed, launch your favorite Internet browser and visit
http://localhost:4848/
, you will be connected to the administration interface of GlassFish. Navigate to Configurations | server-config | JVM-settings in the left-side panel.Add the two JVM options:
javaagent:C:\packtpub\jrebel\jrebel.jar
and-Drebel.log=true
.
To proceed, you will need the latest version of GlassFish 3 (or GlassFish 4), and a Java 6 (or Java 7) JDK. Once installed and configured, launch GlassFish with its startup script l.
Launch your favorite Internet browser and visit http://localhost:4848/
.
Now, add two JVM options as displayed on the following screenshot:
-javaagent:C:\packtpub\jrebel\jrebel.jar
-Drebel.log=true
You already know the first JVM option, this is the JRebel Java Agent.
The second JVM option asks JRebel to enable its logs. These logs will contain information about your current license validity, and so on. We have to turn on this option because GlassFish won't write JRebel logs to the default output. So, without JRebel logs, you could not know If JRebel is correctly loaded by GlassFish.
When you have added the two JVM options and validated the corresponding form, shut down your GlassFish server with the asadmin stop-domain domain1
command. After that, start your server again and check the C:\Packtpub\jrebel\jrebel.log
file. It will contain a lot of information, including the message that indicates your license is active.
Now, please note that you don't need the -Drebel.log=true
JVM option anymore; we used it to check JRebel configuration only. You can edit the GlassFish JVM option list and remove it. Re-enable it only if you encounter problems with JRebel.
Congratulations, your server is now configured to run JRebel!