Jetty in Mule only works in earlier version of Studio

落爺英雄遲暮 提交于 2019-11-30 09:51:37

问题


I'm having problems using the Jetty connectors in Mule.

Within my mule configuration:

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

There is no problem at all when running in Mule Studio (using Mule Server Runtime 3.4.0 CE). However, after importing the project to and running in Anypoint Studio (using Mule Server Runtime 3.5.0 CE), I get the following error:

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

Even if I manually include the Jetty JAR from here to the build path, I get this error:

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.

The same issue is present when running with Mule standalone 3.4.0 CE vs 3.5.0 CE.

In jetty-rest.xml:

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

In jetty-soap.xml:

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

What am I missing or doing wrong?


回答1:


You should not need to add the Jetty JAR yourself: they should be brought in your project as part of the Mule Jetty Transport, which is very much an officially supported core transport:

  • http://www.mulesoft.org/documentation/display/current/Jetty+Transport+Reference
  • https://github.com/mulesoft/mule/tree/mule-3.x/transports/jetty

Was the Jetty transport added to your build path / POM file by Studio?




回答2:


I managed to discover what causes the issue. The Mule 3.5.0 CE Jetty transport now uses Jetty 8, and I was previously using Jetty 6 with Mule 3.4.0 CE.

Within 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

After following the instructions in the link provided I converted my files to use Jetty 8.



来源:https://stackoverflow.com/questions/23892731/jetty-in-mule-only-works-in-earlier-version-of-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!