Apache Camel 2.15.2 not able to create jetty instance

风流意气都作罢 提交于 2019-12-24 14:18:08

问题


When I was using 2.14 version of camel, I was able to get jetty instance created... however 2.15.2 is giving below error while tomcat loads the app

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jetty' defined in ServletContext resource [/WEB-INF/classes/camel-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.component.jetty.JettyHttpComponent]: Is it an abstract class?; nested exception is java.lang.InstantiationException

Here is how my camel context config looks like

bean id="jetty" class="org.apache.camel.component.jetty.JettyHttpComponent"


回答1:


Camel hasn't updated their version of Jetty in a very long time.

The official documentation at camel.apache.org/jetty.html has references to codehaus.org (a website that no longer exists!)

The apidoc references at camel.apache.org/maven/camel-2.14.0/camel-jetty/apidocs/org/apache/camel/component/jetty/JettyHttpComponent.html have references to org.eclipse.jetty.server.nio.SelectChannelConnector which means they are using Jetty 7 or Jetty 8.

Both Jetty 7 and Jetty 8 are EOL (End of Life).

But all is not lost ...

Starting with Camel 2.15.0 there is support for Jetty 9.

  • Support for Jetty 9 using the new camel-component-jetty9 module

Would recommend upgrading Camel.




回答2:


Since Camel 2.15, Jetty component has been dispatched in two components camel-jetty8 and camel-jetty9. camel-jetty, only contains an abstract class that you cannot instantiate.

After importing camel-jetty8 or camel-jetty9, you can simply replace your line:

bean id="jetty" class="org.apache.camel.component.jetty.JettyHttpComponent"

by

bean id="jetty" class="org.apache.camel.component.jetty8.JettyHttpComponent8"

or

bean id="jetty" class="org.apache.camel.component.jetty9.JettyHttpComponent9"


来源:https://stackoverflow.com/questions/32227336/apache-camel-2-15-2-not-able-to-create-jetty-instance

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