【问题标题】:How to integrate JRebel with Mule ESB?如何将 JRebel 与 Mule ESB 集成?
【发布时间】:2016-01-12 22:01:23
【问题描述】:

有没有人尝试过将 JRebel 与 Mule 一起使用,而不是使用典型的应用程序服务器?如果有,您能描述一下您的经历吗?

据我所知,目前,JRebel 团队并未正式支持 Mule。但是,我想知道是否有解决此限制的方法。

【问题讨论】:

    标签: java mule esb jrebel


    【解决方案1】:

    虽然 JRebel 没有正式支持 Mule ESB,但我们找到了一种解决方法。首先,让我先声明:

    • 截至目前,不可能使用 JRebel 热部署 Mule XML 流。然而,Mule 提供了自己的机制来实现同样的目标。因此,缺乏 JRebel 对此的支持并不会破坏交易。

    所以,我们唯一可以热部署的是 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=truewrapper.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 实例中。

    【讨论】:

    • - 提供的一些 JVM 参数不是配置所必需的。首先 JVM 参数 "wrapper.java.additional.15=-agentpath:{path to jrebel64.dll}" 不是必需的,因为您已经配置了 javaagent "wrapper.java.additional.13=-javaagent:{path to jrebel 。罐}”。其次,参数“wrapper.java.additional.20=-Drebel.resource_cache=true”不是必需的,因为默认值为true。
    • 我将根据您的更正更新答案。非常感谢。 :)
    【解决方案2】:

    当我使用指示的点进行配置时,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/>
    

    【讨论】:

      【解决方案3】:


      当我在测试时,我注意到您需要在文件 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/

      【讨论】:

        【解决方案4】:

        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文件。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-11-17
          • 2014-09-10
          • 2013-05-23
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多