6

Has anybody sometime tried to use JRebel with Mule instead of a typical application server? If so, could you describe your experience?

As far as I know, currently, Mule is not officially supported by the JRebel team. However, I was wondering if there might be some workaround to this limitation.

Enrique
  • 866
  • 2
  • 9
  • 20

4 Answers4

4

Although Mule ESB is not officially supported by JRebel, we have found a workaround. First of all, let me start by stating that:

  • As of today, it is not possible to hot-deploy Mule XML flows by using JRebel. Mule, however, offers its own mechanisms for achieving this same thing. As such, the lack of JRebel support for this is no deal breaker.

So, the only thing we can hot-deploy are the Java classes, which is still very welcome. How do we do that?

  • Start by configuring the JRebel agent in $MULE_HOME/conf/wrapper.conf. The required lines, in our case, were:

    wrapper.java.additional.13=-javaagent:{path to jrebel.jar}
    wrapper.java.additional.14=-Xbootclasspath:{path to rebelboot.jar}
    wrapper.java.additional.16=-Drebel.remoting_plugin=true
    wrapper.java.additional.19=-Drebel.remoting_port={whatever}
    

These are the JVM paremeters required to launch JRebel along with Mule. The numbering of the parameters is arbitrary.

We want to use JRebel in remote mode. You can read about this mode in the docs. That's the reason for the wrapper.java.additional.16=-Drebel.remoting_plugin=true and wrapper.java.additional.19=-Drebel.remoting_port={whatever} paremeters.

  • Now go ahead and launch Mule by either executing mule.bat or mule.sh, depending on your environment (Windows or *nix). JRebel should start along with it.
  • Place your Mule applications inside $MULE_HOME/apps. They will be automatically deployed and, from now on, their .class files will be monitored by JRebel.
  • Inside your IDE, install the JRebel plugin and apply your license. Afterwards, add the JRebel nature to your project and configure its remote server URL using the port we previously defined inside wrapper.conf.
  • Do whatever changes you need to do to your code and sync. They should be successfully hot-deployed into the running Mule instance.
Enrique
  • 866
  • 2
  • 9
  • 20
  • - Some of the JVM parameters presented are not required for the configuration. First the JVM parameter "wrapper.java.additional.15=-agentpath:{path to jrebel64.dll}" is not necessary because you have already configured the javaagent "wrapper.java.additional.13=-javaagent:{path to jrebel.jar}". Second the parameter "wrapper.java.additional.20=-Drebel.resource_cache=true" is not necessary because the default value is true. – Manuel Saucedo Oct 21 '15 at 19:43
  • I'll be updating the answer with your corrections. Thanks a lot. :) – Enrique Oct 21 '15 at 20:25
3


when I was testing, I noticed that you need to add in the file wrapper.conf the next attributes:

wrapper.java.additional.18=-Drebel.log=true
wrapper.java.additional.19=-Drebel.log.file=/MyPath/LogName.log

With these the JRebel runs correctly. In conclusion, when we´re using a specific port, is necessary to enable JRebel’s logging.
More information, check in Step 6:
https://zeroturnaround.com/software/jrebel/learn/remoting/setting-up-jrebel-remoting-with-intellij-idea-and-tomcat/

JhonQO
  • 368
  • 3
  • 7
1

When I configured with the points indicated, I have the next exception in Mule´s console:

Launching a JVM...

2015-10-27 11:00:27 JRebel: WARN You are running JRebel using the -javaagent option on a system where -agentpath is supported.<br/>
2015-10-27 11:00:29 JRebel: Monitoring Log4j configuration in 'file:/C:/Dev/Mule%20-%2002-esb-mule-ee%20-%203.4/conf/log4j.properties'.<br/>
Exception in thread "main" java.lang.NoSuchMethodError: javax.xml.parsers.SecuritySupport$1: method <init>()V not found<br/>
        at javax.xml.parsers.SecuritySupport.getContextClassLoader(Unknown Source)<br/>
        at javax.xml.parsers.FactoryFinder.find(Unknown Source)<br/>
        at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)<br/>
        at com.opensymphony.module.propertyset.config.PropertySetConfig.<init>(PropertySetConfig.java:53)<br/>
        at com.opensymphony.module.propertyset.config.PropertySetConfig.getConfig(PropertySetConfig.java:113)<br/>
        at com.opensymphony.module.propertyset.PropertySetManager.getInstance(PropertySetManager.java:32)<br/>
        at com.opensymphony.module.propertyset.PropertySetManager.getInstance(PropertySetManager.java:22)<br/>
        at com.mulesource.licm.pref.MulePropertySetPreferences.loadPropertySet(MulePropertySetPreferences.java:208)<br/>
        at com.mulesource.licm.pref.MulePropertySetPreferences.<clinit>(MulePropertySetPreferences.java:50)<br/>
        at com.mulesource.licm.pref.MulePreferencesFactory.<clinit>(MulePreferencesFactory.java:19)<br/>
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)<br/>
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)<br/>
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)<br/>
        at java.lang.reflect.Constructor.newInstance(Unknown Source)<br/>
        at java.lang.Class.newInstance(Unknown Source)<br/>
        at java.util.prefs.Preferences.factoryOrig(Unknown Source)<br/>
        at java.util.prefs.Preferences.userRoot(Unknown Source)<br/>
        at com.mulesource.licm.impl.TrueLicenseHelper.createLicenseManagerParameters (TrueLicenseHelper.java:338)<br/>
        at com.mulesource.licm.impl.TrueLicenseHelper.createLicenseManagerParameters(TrueLicenseHelper.java:330)<br/>
        at com.mulesource.licm.impl.TrueLicenseHelper.<init>(TrueLicenseHelper.java:120)<br/>
        at com.mulesource.licm.impl.MuleLicenseManager.<init>(MuleLicenseManager.java:25)<br/>
        at com.mulesource.licm.LicenseManagementFactory.createLicenseManager(LicenseManagementFactory.java:48)<br/>
        at org.mule.module.boot.LicenseKeyHandler.<init>(LicenseKeyHandler.java:43)<br/>
        at org.mule.module.reboot.MuleContainerBootstrap.handleLicenseKey(MuleContainerBootstrap.java:192)<br/>
        at org.mule.module.reboot.MuleContainerBootstrap.main(MuleContainerBootstrap.java:62)<br/>
Faraj Farook
  • 14,385
  • 16
  • 71
  • 97
JhonQO
  • 368
  • 3
  • 7
0

Configuration JRebel in Mule is very similar to configuration in tc Server.

You need to add JRebel Agent as a wrapper.java.additional.* property in $MULE_HOME/conf/wrapper.conf:

wrapper.java.additional.10=-agentpath:[c:\path\to]lib\jrebel64.dll

If you use Java version 7 and newer you use agent:

Windows 64-bit JDK  jrebel64.dll
Windows 32-bit JDK  jrebel32.dll
Mac OS X 64-bit JDK libjrebel64.dylib
Mac OS X 32-bit JDK libjrebel32.dylib
Linux 64-bit JDK    libjrebel64.so
Linux 32-bit JDK    libjrebel32.so

If you use Java version 6 and below, you need to use legacy agent jrebel.jar file.