如何将 JRebel 与 Mule ESB 集成?
How to integrate JRebel with Mule ESB?
有没有人曾尝试将 JRebel 与 Mule 一起使用而不是典型的应用程序服务器?如果有,您能描述一下您的经历吗?
据我所知,目前,Mule 还没有得到 JRebel 团队的官方支持。但是,我想知道是否可以解决此限制。
尽管 JRebel 未正式支持 Mule ESB,但我们找到了解决方法。首先,让我先声明:
- 截至今天,无法 可以使用 JRebel 热部署 Mule XML 流。然而,Mule 提供了自己的机制来实现同样的目标。因此,缺少 JRebel 对此的支持不会破坏交易。
所以,我们唯一可以热部署的是Java classes,这还是很受欢迎的。我们该怎么做?
首先在 $MULE_HOME/conf/wrapper.conf 中配置 JRebel 代理。在我们的例子中,所需的行是:
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}
这些是启动 JRebel 和 Mule 所需的 JVM 参数。参数编号任意。
我们想在远程模式下使用 JRebel。您可以在 docs 中阅读有关此模式的信息。这就是 wrapper.java.additional.16=-Drebel.remoting_plugin=true
和 wrapper.java.additional.19=-Drebel.remoting_port={whatever}
参数的原因。
- 现在继续并通过执行 mule.bat 或 mule.sh 来启动 Mule,具体取决于您的环境(Windows 或 *nix)。 JRebel 应该从它开始。
- 将您的 Mule 应用程序放在 $MULE_HOME/apps 中。它们将被自动部署,从现在开始,它们的 .class 文件将由 JRebel 监控。
- 在您的 IDE 中,安装 JRebel 插件 并应用您的许可证。之后,将 JRebel 特性添加到您的项目中,并使用我们之前在
wrapper.conf
. 中定义的端口配置其远程服务器 URL
- 对代码进行任何需要的更改并同步。它们应该成功地热部署到 运行 Mule 实例中。
当我按照指定的点进行配置时,我在 Mule 的控制台中出现了下一个异常:
启动 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: 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/>
当我测试时,我注意到您需要在文件 wrapper.conf 中添加下一个属性:
wrapper.java.additional.18=-Drebel.log=真
wrapper.java.additional.19=-Drebel.log.file=/MyPath/LogName.log
有了这些,JRebel 就能正确运行。总之,当我们使用特定端口时,启用 JRebel 的日志记录是必要的。
更多信息,查看第6步:
https://zeroturnaround.com/software/jrebel/learn/remoting/setting-up-jrebel-remoting-with-intellij-idea-and-tomcat/
Mule 中的配置 JRebel 与 configuration in tc Server 非常相似。
您需要将 JRebel Agent 添加为 wrapper.java.additional.*
属性 in $MULE_HOME/conf/wrapper.conf
:
wrapper.java.additional.10=-agentpath:[c:\path\to]lib\jrebel64.dll
如果您使用 Java 版本 7 和更高版本,您将使用代理:
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
如果你使用Java版本6及以下,你需要使用legacy agentjrebel.jar文件。
有没有人曾尝试将 JRebel 与 Mule 一起使用而不是典型的应用程序服务器?如果有,您能描述一下您的经历吗?
据我所知,目前,Mule 还没有得到 JRebel 团队的官方支持。但是,我想知道是否可以解决此限制。
尽管 JRebel 未正式支持 Mule ESB,但我们找到了解决方法。首先,让我先声明:
- 截至今天,无法 可以使用 JRebel 热部署 Mule XML 流。然而,Mule 提供了自己的机制来实现同样的目标。因此,缺少 JRebel 对此的支持不会破坏交易。
所以,我们唯一可以热部署的是Java classes,这还是很受欢迎的。我们该怎么做?
首先在 $MULE_HOME/conf/wrapper.conf 中配置 JRebel 代理。在我们的例子中,所需的行是:
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}
这些是启动 JRebel 和 Mule 所需的 JVM 参数。参数编号任意。
我们想在远程模式下使用 JRebel。您可以在 docs 中阅读有关此模式的信息。这就是 wrapper.java.additional.16=-Drebel.remoting_plugin=true
和 wrapper.java.additional.19=-Drebel.remoting_port={whatever}
参数的原因。
- 现在继续并通过执行 mule.bat 或 mule.sh 来启动 Mule,具体取决于您的环境(Windows 或 *nix)。 JRebel 应该从它开始。
- 将您的 Mule 应用程序放在 $MULE_HOME/apps 中。它们将被自动部署,从现在开始,它们的 .class 文件将由 JRebel 监控。
- 在您的 IDE 中,安装 JRebel 插件 并应用您的许可证。之后,将 JRebel 特性添加到您的项目中,并使用我们之前在
wrapper.conf
. 中定义的端口配置其远程服务器 URL
- 对代码进行任何需要的更改并同步。它们应该成功地热部署到 运行 Mule 实例中。
当我按照指定的点进行配置时,我在 Mule 的控制台中出现了下一个异常:
启动 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: 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/>
当我测试时,我注意到您需要在文件 wrapper.conf 中添加下一个属性:
wrapper.java.additional.18=-Drebel.log=真
wrapper.java.additional.19=-Drebel.log.file=/MyPath/LogName.log
有了这些,JRebel 就能正确运行。总之,当我们使用特定端口时,启用 JRebel 的日志记录是必要的。
更多信息,查看第6步:
https://zeroturnaround.com/software/jrebel/learn/remoting/setting-up-jrebel-remoting-with-intellij-idea-and-tomcat/
Mule 中的配置 JRebel 与 configuration in tc Server 非常相似。
您需要将 JRebel Agent 添加为 wrapper.java.additional.*
属性 in $MULE_HOME/conf/wrapper.conf
:
wrapper.java.additional.10=-agentpath:[c:\path\to]lib\jrebel64.dll
如果您使用 Java 版本 7 和更高版本,您将使用代理:
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
如果你使用Java版本6及以下,你需要使用legacy agentjrebel.jar文件。