JRebel with Docker¶
JRebel remote server functionality is available for virtual machines running on Docker. The following details need to be kept in mind when running JRebel with Docker.
The Docker container needs to include the JRebel Agent and its platform-specific library. You can download the newest JRebel here.
You need to enable JRebel for the application server in Docker. Add
-Drebel.remoting_plugin=trueto the startup parameters. You will need to replace the library placeholder with the correct operating system and 32 or 64 bit library:
Windows 64-bit JDK
Windows 32-bit JDK
Mac OS X 64-bit JDK
Mac OS X 32-bit JDK
Linux 64-bit JDK
Linux 32-bit JDK
The JRebel IDE plugin and project need to be configured with the remote server information. You need to enable remote server support for the project and configure the JRebel IDE plugin to connect to the Docker server. For more information, refer to remote server overview.
Refer to the running servers from command line chapter to learn more about adding JRebel to various application servers.
Example for JRebel with Dockerfile and Tomcat 9.0 (Linux 64-bit)¶
libfolder from the root of the downloaded archive. Copy these files to the folder that you will use to generate the image.
Create a new
Dockerfilein the same folder with the following content:
FROM tomcat:9.0 COPY jrebel.jar /jrebel.jar COPY lib/libjrebel64.so /lib/libjrebel64.so ENV JAVA_OPTS="-agentpath:/libjrebel64.so -Drebel.remoting_plugin=true -Drebel.log.file=/jrebel.log"
Build your Docker image.
$ docker build -t [desired image title] .
Run your Docker container!
To use remote server functionality, add your Docker server address to your IDE workspace for synchronization.
Example for JRebel with Docker Compose and Tomcat 9.0 (Linux 64-bit)¶
libfolder from the root of the downloaded archive. Copy these files to the folder that you will use to generate the container.
Create a new
docker-compose.ymlor add to an existing
docker-compose.ymlthe following content:
container-name: image: tomcat:9.0 volumes: - ./jrebel.jar:/jrebel.jar - ./lib/libjrebel64.so:/lib/libjrebel64.so environment: - JAVA_OPTS=-agentpath:/lib/libjrebel64.so -Drebel.remoting_plugin=true -Drebel.log.file=/jrebel.log
Restart your Docker Compose app. Run:
$ docker-compose down $ docker-compose up
To use remote server functionality, add your Docker server address to your IDE workspace for synchronization. Please refer to this page for more information.
Running into an issue?¶
To access the logs located in the Docker container perform the following steps. Find your container ID:
$ docker ps
This will provide a list of the Docker Containers located on the machine. From that list copy the Docker Container ID of the container in question.
$ docker cp [Container ID]:/jrebel.log /path/on/host/machine/jrebel.log
The log will be located in the
/path/on/host/machine directory on the host machine.