You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by krishy <ca...@gmail.com> on 2011/06/28 18:41:18 UTC

Recommended way of packaging Camel in a web-app

I see an older 
http://camel.465427.n5.nabble.com/Camel-ActiveMQ-in-Tomcat6-td474122.html
thread  talk about this but to understand better (and get clarification on
another issue mentioned below), I would like to know the opinion of the list
on the recommended way of packaging Camel in an webapp. Our Camel context is
started using Spring and is used to send and consume messages from an
ActiveMQ instance that is running in another server. FWIW, the webapp is
deployed in Jetty and we use the ActiveMQ's PooledConnectionFactory to pool
connections from Camel.

I started off with the following:

In WEB-INF/lib/camel-core, camel-jms, camel-spring, camel-xstream and other
webapp jars
In $JETTY_HOME/lib/ext/activemq-all, activemq-pool

This resulted in the container failing to start with ClassNotFoundException
for org.apache.camel.component.jms.JmsComponent. After some trial and error,
I ended up with the following setup which starts up the web-app and
everything works fine.

In WEB-INF/lib/activemq-camel, camel-jms, camel-spring, camel-xstream and
other webapp jars (Hibernate, Spring etc.,)
In $JETTY_HOME/lib/ext/activemq-core, activemq-pool, camel-core,
commons-pool, commons-management, geronimo-j2ee-management, geronimo-jms

However, the following is mentioned in the start-up log:

org.apache.camel.spring.SpringCamelContext  - Cannot find needed classes for
JMX lifecycle strategy. Needed class is in spring-context.jar us
ing Spring 2.5 or newer (spring-jmx.jar using Spring 2.0.x).
NoClassDefFoundError:
org/springframework/jmx/export/metadata/JmxAttributeSource
[2011-06-27 20:37:00,605] [main] WARN 
org.apache.camel.spring.SpringCamelContext  - Cannot use JMX. Fallback to
using DefaultManagementStrategy (non JMX).

This class is part of spring-context and is in fact available under
WEB-INF/. Now should Spring framework jars also be a 'shared' to get this up
and running cleanly?
What is the recommended way of packaging Camel in a webapp?

It would be nice to have this elaborated upon in the 
http://camel.apache.org/tutorial-on-using-camel-in-a-web-application.html
tutorial  as well.

Thanks!

--
View this message in context: http://camel.465427.n5.nabble.com/Recommended-way-of-packaging-Camel-in-a-web-app-tp4532417p4532417.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Recommended way of packaging Camel in a web-app

Posted by boday <be...@initekconsulting.com>.
You can just create a big WAR that has everything it needs.  See this example
project that ships with Camel...
https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-servlet-tomcat
camel-example-servlet-tomcat .

Then, you should be able to drop it into any servlet container and be up and
running.  Are you wanting to explicitly excluded dependencies from the WAR
file?


krishy wrote:
> 
> Thanks Don. But I would like some clarity on the other points - which jar
> goes where. My approach of throwing stuff in the various places and seeing
> which one sticks just doesn't seem right.
> 


-----
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: http://camel.465427.n5.nabble.com/Recommended-way-of-packaging-Camel-in-a-web-app-tp4532417p4533685.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Recommended way of packaging Camel in a web-app

Posted by krishy <ca...@gmail.com>.
Thanks Don. But I would like some clarity on the other points - which jar
goes where. My approach of throwing stuff in the various places and seeing
which one sticks just doesn't seem right.

--
View this message in context: http://camel.465427.n5.nabble.com/Recommended-way-of-packaging-Camel-in-a-web-app-tp4532417p4532613.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Recommended way of packaging Camel in a web-app

Posted by Donald Whytock <dw...@gmail.com>.
I see that JMX warning in my OSGi-based application too.  The
application seems to work, so I've always ignored the warning.

Don

On Tue, Jun 28, 2011 at 12:41 PM, krishy <ca...@gmail.com> wrote:
> I see an older
> http://camel.465427.n5.nabble.com/Camel-ActiveMQ-in-Tomcat6-td474122.html
> thread  talk about this but to understand better (and get clarification on
> another issue mentioned below), I would like to know the opinion of the list
> on the recommended way of packaging Camel in an webapp. Our Camel context is
> started using Spring and is used to send and consume messages from an
> ActiveMQ instance that is running in another server. FWIW, the webapp is
> deployed in Jetty and we use the ActiveMQ's PooledConnectionFactory to pool
> connections from Camel.
>
> I started off with the following:
>
> In WEB-INF/lib/camel-core, camel-jms, camel-spring, camel-xstream and other
> webapp jars
> In $JETTY_HOME/lib/ext/activemq-all, activemq-pool
>
> This resulted in the container failing to start with ClassNotFoundException
> for org.apache.camel.component.jms.JmsComponent. After some trial and error,
> I ended up with the following setup which starts up the web-app and
> everything works fine.
>
> In WEB-INF/lib/activemq-camel, camel-jms, camel-spring, camel-xstream and
> other webapp jars (Hibernate, Spring etc.,)
> In $JETTY_HOME/lib/ext/activemq-core, activemq-pool, camel-core,
> commons-pool, commons-management, geronimo-j2ee-management, geronimo-jms
>
> However, the following is mentioned in the start-up log:
>
> org.apache.camel.spring.SpringCamelContext  - Cannot find needed classes for
> JMX lifecycle strategy. Needed class is in spring-context.jar us
> ing Spring 2.5 or newer (spring-jmx.jar using Spring 2.0.x).
> NoClassDefFoundError:
> org/springframework/jmx/export/metadata/JmxAttributeSource
> [2011-06-27 20:37:00,605] [main] WARN
> org.apache.camel.spring.SpringCamelContext  - Cannot use JMX. Fallback to
> using DefaultManagementStrategy (non JMX).
>
> This class is part of spring-context and is in fact available under
> WEB-INF/. Now should Spring framework jars also be a 'shared' to get this up
> and running cleanly?
> What is the recommended way of packaging Camel in a webapp?
>
> It would be nice to have this elaborated upon in the
> http://camel.apache.org/tutorial-on-using-camel-in-a-web-application.html
> tutorial  as well.
>
> Thanks!
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Recommended-way-of-packaging-Camel-in-a-web-app-tp4532417p4532417.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Recommended way of packaging Camel in a web-app

Posted by Willem Jiang <wi...@gmail.com>.
spring-jmx is need in the camel-core, if you don't want to use the JMX 
to manage the camel you can ignore this warn, as camel will use a 
fallback default management strategy.

On 6/29/11 12:41 AM, krishy wrote:
> org.apache.camel.spring.SpringCamelContext  - Cannot find needed classes for
> JMX lifecycle strategy. Needed class is in spring-context.jar us
> ing Spring 2.5 or newer (spring-jmx.jar using Spring 2.0.x).
> NoClassDefFoundError:
> org/springframework/jmx/export/metadata/JmxAttributeSource
> [2011-06-27 20:37:00,605] [main] WARN
> org.apache.camel.spring.SpringCamelContext  - Cannot use JMX. Fallback to
> using DefaultManagementStrategy (non JMX).
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang