Managing the Camel libraries and Setting up the Camel Classpath in Tomcat

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Managing the Camel libraries and Setting up the Camel Classpath in Tomcat

Gnanaguru S
This post was updated on .
Hi

I have quite a critical issue to be solved. I am running my camel applications in Tomcat7. Everyday the complexity of the application increases and application grows.

Adding multiple dependencies, plugins to the pom file adds multiple JAR files to the WAR file. ( WEB_INF\lib). My tomcat instance was not able to handle it. It crashes.

I tuned the memory of Tomcat, And managed. But I have a fear this could be a big issue to manage in real time.

I need a solution to solve this.

1. Can I dump all the jars to the Tomcat server library and get it referred by my Camel Application ?
2. Can I create a separate WAR file which will have only the libraries, Can I refer it from another WAR ? Inter WAR reference is possible ?

This could be a definite solution to be discussed. Please refer any link which has the solution for this problem already.

Best,
Guru
@gnanagurus
Reply | Threaded
Open this post in threaded view
|

Re: Managing the Camel libraries and Setting up the Camel Classpath in Tomcat

Charles Moulliard
Hi Guru,

What I suggest in this case is that you move camel jars files in Tomcat classloader. This is what we suggest to do when we would like to use the vm component from different war files (http://camel.apache.org/vm.html). I recommend that you google and have a look to Tomcat document to check How to configure it (http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html). The file to be configure is catalina.properties under conf directory

Regards,

Charles
Apache Committer / Sr. Pr. Consultant at FuseSource.com
Email: [hidden email]
Twitter : @cmoulliard, @fusenews
Blog : http://cmoulliard.blogspot.com
Reply | Threaded
Open this post in threaded view
|

Re: Managing the Camel libraries and Setting up the Camel Classpath

Christian Mueller
Administrator
In reply to this post by Gnanaguru S
Again, you should provide more detailed information if you want help. What
was the error you got? Did you changed some Java VM parameter to solve it?
Could you provode your dependency tree?
Your questions are not Camel related, by the way... But yes for question 1)
and I think no for 2) (Classes in WAR 2 should not see classes in WAR 1).

Sent from a mobile device
Am 13.08.2012 08:19 schrieb "Gnanaguru S" <[hidden email]>:

> Hi
>
> I have quite a critical issue to be solved. I am running my camel
> applications in Tomcat7. Everyday the complexity of the application
> increases and application grows.
>
> Adding multiple dependencies, plugins to the pom file adds multiple JAR
> files to the WAR file. ( WEB_INF\lib). My tomcat instance was not able to
> handle it. It crashes.
>
> I tuned the memory of Tomcat, And managed. But I have a fear this could be
> a
> big issue to manage in real time.
>
> I need a solution to solve this.
>
> 1. Can I dump all the jars to the Tomcat server library and get it referred
> by my Camel Application ?
> 2. Can I create a separate WAR file which will have only the libraries, Can
> I refer it from another WAR ? Inter WAR reference is possible ?
>
> This could be a definite solution to be discussed. Please refer any link
> which has the solution for this problem already.
>
> Best,
> Guru
> @gnanagurus
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Managing-the-Camel-libraries-and-Setting-up-the-Camel-Classpath-tp5717187.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Managing the Camel libraries and Setting up the Camel Classpath

hekonsek
Hi guys.

> and I think no for 2) (Classes in WAR 2 should not see classes in WAR 1).

100% no. Each web application has it's own classloader [1].

Guru, you want to send this message to some Tomcat user group. You
basically ask us how to deploy large application on Tomcat. I'm sure
that people at Tomcat mailing list [2] will provide you a better
answer then Camel riders :) .

[1] http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
[2] http://tomcat.apache.org/lists.html

--
Henryk Konsek
http://henryk-konsek.blogspot.com
Reply | Threaded
Open this post in threaded view
|

Re: Managing the Camel libraries and Setting up the Camel Classpath

Christian Schneider
In reply to this post by Gnanaguru S
Hi Guru,

you can move the camel dependencies to the tomcat classloader so they
are available to all wars. Quite often though this leads to problems.
For example if you want to update
a war file to a newer versionof some libs it can get very complex very
soon.

So I think you should also look into another possible solution. To use
camel in OSGi. Apache Karaf or Servicemix are very nice platforms for this.
The initial effort is higher as you have to port your integrations to
OSGi but it is not that difficult.

The payoff is that you can have all your depenencies as bundles and so
the typical deployment size goes down to a few hundred KB instead of
tens of MB. So if you have many integrations on your server it really
pays of soon.

Karaf also supports a lot of management features that can really help you.

I have two tutorials aobut the theme that might be of interest for you
if your are interested in that path:
http://www.liquid-reality.de/display/liquid/2012/01/03/Karaf+Tutorial+Part+5+-+Running+Apache+Camel+integrations+in+OSGi
http://www.liquid-reality.de/display/liquid/2012/07/20/Apache+Karaf+Tutorial+Part+7+-+Camel+JPA+and+JTA+transactions

Christian

Am 13.08.2012 08:19, schrieb Gnanaguru S:

> Hi
>
> I have quite a critical issue to be solved. I am running my camel
> applications in Tomcat7. Everyday the complexity of the application
> increases and application grows.
>
> Adding multiple dependencies, plugins to the pom file adds multiple JAR
> files to the WAR file. ( WEB_INF\lib). My tomcat instance was not able to
> handle it. It crashes.
>
> I tuned the memory of Tomcat, And managed. But I have a fear this could be a
> big issue to manage in real time.
>
> I need a solution to solve this.
>
> 1. Can I dump all the jars to the Tomcat server library and get it referred
> by my Camel Application ?
> 2. Can I create a separate WAR file which will have only the libraries, Can
> I refer it from another WAR ? Inter WAR reference is possible ?
>
> This could be a definite solution to be discussed. Please refer any link
> which has the solution for this problem already.
>
> Best,
> Guru
> @gnanagurus
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Managing-the-Camel-libraries-and-Setting-up-the-Camel-Classpath-tp5717187.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com

Reply | Threaded
Open this post in threaded view
|

Re: Managing the Camel libraries and Setting up the Camel Classpath

Gnanaguru S
In reply to this post by Christian Mueller

Thank you Christian,

I was caught up with out of memory error in tomcat.


" SEVERE: Error waiting for multi-thread deployment of WAR files to complete
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space "


It was resolved by setting up JAVA_OPTS  as 128m -Xmx1024m -XX:MaxPermSize=512m.

I understand about your point, I will take this to Tomcat forums and try to solve this. And I thought there might be some best practices found early for this case already.

I would post back to this chain once I find a solution. Could be useful for our camel users in Tomcat/ any other Webapp.

Best,
Guru
@gnanagurus



Reply | Threaded
Open this post in threaded view
|

Re: Managing the Camel libraries and Setting up the Camel Classpath

Gnanaguru S
In reply to this post by hekonsek

Thanks Henry, I wont go with the thought of Inter WAR.

I will get back with a solution once I find it with Tomcat forums.

Regards
Guru
@gnanagurus
Reply | Threaded
Open this post in threaded view
|

Re: Managing the Camel libraries and Setting up the Camel Classpath

Gnanaguru S
In reply to this post by Christian Schneider

Hi Christian,

Thanks for your effort of getting this elaborate answer. And gladly I am using Camel seriously with ServiceMix. Karaf provides a great console to manage features, And I love that model.

I started with Camel & Tomcat to test it, And most Interestingly this issue came up and I thought it would be interesting to discuss here.

I will take this to Tomcat forums and try to fix it up. And I have to propose Camel+SMX model again if test throws incompatible results.

Thank you again,
Guru
@gnanagurus
Reply | Threaded
Open this post in threaded view
|

Re: Managing the Camel libraries and Setting up the Camel Classpath

hekonsek
In reply to this post by Christian Schneider
> you can move the camel dependencies to the tomcat classloader so they are
> available to all wars. Quite often though this leads to problems. For
> example if you want to update
> a war file to a newer versionof some libs it can get very complex very soon.

I would say even more - putting application libraries into the
container's lib is a maintenance nightmare and leads to library
incompatibility bugs which are *really* hard to debug.  This very bad
practice IMHO and I strongly disencourage this approach :) .

> So I think you should also look into another possible solution. To use camel
> in OSGi. Apache Karaf or Servicemix are very nice platforms for this.
> The initial effort is higher as you have to port your integrations to OSGi
> but it is not that difficult.

Good point. Also Karaf distribution comes with the example of
embedding it in the web container. I've never run ServiceMix embedded
in a such way in production, but technically it is possible to do it
:) .

--
Henryk Konsek
http://henryk-konsek.blogspot.com