【发布时间】:2016-01-12 22:01:23
【问题描述】:
有没有人尝试过将 JRebel 与 Mule 一起使用,而不是使用典型的应用程序服务器?如果有,您能描述一下您的经历吗?
据我所知,目前,JRebel 团队并未正式支持 Mule。但是,我想知道是否有解决此限制的方法。
【问题讨论】:
有没有人尝试过将 JRebel 与 Mule 一起使用,而不是使用典型的应用程序服务器?如果有,您能描述一下您的经历吗?
据我所知,目前,JRebel 团队并未正式支持 Mule。但是,我想知道是否有解决此限制的方法。
【问题讨论】:
虽然 JRebel 没有正式支持 Mule ESB,但我们找到了一种解决方法。首先,让我先声明:
所以,我们唯一可以热部署的是 Java 类,它仍然非常受欢迎。我们如何做到这一点?
首先在 $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}
这些是与 Mule 一起启动 JRebel 所需的 JVM 参数。参数的编号是任意的。
我们想在远程模式下使用 JRebel。您可以在docs 中了解此模式。这就是 wrapper.java.additional.16=-Drebel.remoting_plugin=true 和 wrapper.java.additional.19=-Drebel.remoting_port={whatever} 参数的原因。
wrapper.conf 中定义的端口配置其远程服务器 URL。【讨论】:
当我使用指示的点进行配置时,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$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/>
【讨论】:
当我在测试时,我注意到您需要在文件 wrapper.conf 中添加下一个属性:
wrapper.java.additional.18=-Drebel.log=true
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 非常相似。
您需要在$MULE_HOME/conf/wrapper.conf 中添加JRebel Agent 作为wrapper.java.additional.* 属性:
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文件。
【讨论】: