Where is the "jrebel JAR-file" in the my WAR-file?

1k Views Asked by At

I want to use jrebel with intellij IDEA and JBOSS AS7.

(have a web application(so have WAR)).

By apache-ANT , build my-WAR and deploy it under JBOSS AS.

I know how introduce any changes of classes or resources to jrebel in the my-WAR (If I'm not mistaken!) , as follows:

(In rebel.xml)

<classpath>
    <dir name="D:/project/myProject/out/production/myProject">
    </dir>
</classpath>

<web>
    <link target="/">
        <dir name="D:/project/myProject/resources">
        </dir>
        <dir name="D:/project/myProject/view">
        </dir>
    </link>
</web>

But, really, "jerebel jar-file" Where is the my-WAR?

in => "warFile >WEB-INF > lib"?I did not see it.

please help me.

1

There are 1 best solutions below

0
On BEST ANSWER

jrebel.jar is packaged inside the JRebel plugin for IntelliJ IDEA. It doesn't have to be deployed with the WAR itself. JRebel plugin will set the correct JVM parameters to the command line when you start via "Run with JRebel" or "Debug with JRebel":

-javaagent:/path/to/jrebel.jar

UPDATE: the newer versions of JRebel are configured using -agentpath JVM option instead:

-agentpath:${JREBEL_HOME}/lib/<platform-specific-binary>

See the documentation reference of the correct settings.


You don't have to do it yourself if you start the server from the IDE. If you start the server from the command line then you would have to add the JVM argument yourself with the correct path to jrebel.jar as described here: http://manuals.zeroturnaround.com/jrebel/standalone/launch-from-command-line.html#jboss-7-x

Java agents intercept class loading and thus have to be loaded before other classes. As you might have guessed, jrebel.jar is a Java agent and therefor nothing requires it to be packaged inside a WAR.

Instead, rebel.xml, the configuration file, has to be packaged in the WAR, in WEB-INF/classes directory. JRebel uses rebel.xml to detect, where the compiled classes and resources are. So when the application is deployed, JRebel finds rebel.xml configuration file and won't load the application classes from WAR itself, but instead it will use the path that is specified in that rebel.xml file. This is why rebel.xml has to be inside the war, as you may also start the server from command line instead of the IDE.