【问题标题】:Jetty in Mule only works in earlier version of StudioMule 中的 Jetty 仅适用于早期版本的 Studio
【发布时间】:2014-07-16 13:28:56
【问题描述】:

我在 Mule 中使用 Jetty 连接器时遇到问题。

在我的mule 配置中:

<jetty:connector name="JettyRest" configFile="jetty-rest.xml" doc:name="Jetty" />
<jetty:connector name="JettySoap" configFile="jetty-soap.xml" doc:name="Jetty" />

在Mule Studio中运行完全没有问题(使用Mule Server Runtime 3.4.0 CE)。但是,在将项目导入 Anypoint Studio 并在其中运行后(使用 Mule Server Runtime 3.5.0 CE),我收到以下错误:

Cannot load class 'org.mortbay.jetty.Server'

即使我手动将Jetty JAR from here 包含到构建路径中,我也会收到此错误:

Object of class 'org.eclipse.jetty.server.Server' is not of type 'org.mortbay.jetty.Server'. Object Class and type Class are from different loaders.

使用 Mule 独立运行 3.4.0 CE3.5.0 CE 时存在相同的问题。

jetty-rest.xml:

<Configure id="Server" class="org.mortbay.jetty.Server">

jetty-soap.xml:

<Configure id="ServerForSlow" class="org.mortbay.jetty.Server">

我错过了什么或做错了什么?

【问题讨论】:

  • 您使用的是 Jetty 传输还是第三方连接器?有关说明的链接无效。
  • @AleSequeira 这是 Mule Jetty 连接器。我链接的说明页面似乎在过去 20 分钟内被删除了。
  • 为什么不使用 Jetty Transport,它是 Mule 支持的交通工具?
  • @AleSequeira 我指的是码头运输。如果我不包含 Jetty JAR,我会收到错误 Cannot load class 'org.mortbay.jetty.Server'。这在 Mule 的早期版本中根本不会发生。

标签: jetty mule mule-studio


【解决方案1】:

我设法发现了导致问题的原因。 Mule 3.5.0 CE Jetty 运输现在使用 Jetty 8,而我之前使用 Jetty 6 和 Mule 3.4.0 CE

MIGRATION.txt内:

MULE-7061: Jetty transport is now using Jetty 8. Applications using a custom jetty.xml configuration file must update the Jetty classes referenced in this file due to package names changed from version 6 to 7, as explained here: http://wiki.eclipse.org/Jetty/Starting/Porting_to_Jetty_7/Packages_and_Classes

在关注instructions in the link provided 之后,我将文件转换为使用 Jetty 8。

【讨论】:

    【解决方案2】:

    您不需要自己添加 Jetty JAR:它们应该作为 Mule Jetty Transport 的一部分引入您的项目,这是官方支持的核心传输:

    Jetty 传输是否由 Studio 添加到您的构建路径/POM 文件中?

    【讨论】:

    • 在使用 Mule Studio (Mule Server 3.4.1) 的原始项目中,我不必添加 Jetty JAR。但是,将该项目导入 Anypoint Studio (Mule Server 3.5.0) 后,我收到错误 Cannot load class 'org.mortbay.jetty.Server'。这就是我尝试添加 Jetty JAR 的原因,它现在给出了我的问题中指出的错误。
    • Jetty transport 应该带来这个 JAR。您的项目构建路径/POM 中是否有 Jetty 传输?
    • Mule Server 3.5.0 EE 库包含许多 Jetty JAR... 但是,pom.xml 似乎不包含任何 Jetty 配置。
    • 甚至连 provided 作用域的 Jetty 运输都没有?
    • 不,唯一的 provided 范围是 groupId org.apache.httpcomponents
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-25
    • 1970-01-01
    • 1970-01-01
    • 2010-11-02
    相关资源
    最近更新 更多